﻿using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
using KKSG;
using MiniJSON;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUpdater;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x02000BD0 RID: 3024
	internal class XChatView : DlgBase<XChatView, XChatBehaviour>
	{
		// Token: 0x1700307C RID: 12412
		// (get) Token: 0x0600AC56 RID: 44118 RVA: 0x001FB360 File Offset: 0x001F9560
		// (set) Token: 0x0600AC57 RID: 44119 RVA: 0x001FB378 File Offset: 0x001F9578
		public XChatView.ChatGroupState groupState
		{
			get
			{
				return this._groupState;
			}
			set
			{
				this.ShowGroup(value);
				this._groupState = value;
			}
		}

		// Token: 0x0600AC58 RID: 44120 RVA: 0x001FB38C File Offset: 0x001F958C
		private void RegistGroupEvent()
		{
			base.uiBehaviour.m_sprGroupQuit.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGroupQuitClick));
			base.uiBehaviour.m_sprGroupClear.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGroupClearClick));
			base.uiBehaviour.m_sprGroupBind.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGroupBindClick));
			base.uiBehaviour.m_sprGroupBack.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGroupBackClick));
			base.uiBehaviour.m_sprMember.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMemberClick));
			base.uiBehaviour.m_sprList.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnListClick));
			base.uiBehaviour.m_sprMore.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMoreClick));
			base.uiBehaviour.m_sprGroupCreate.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnGroupCreateClick));
		}

		// Token: 0x0600AC59 RID: 44121 RVA: 0x001FB484 File Offset: 0x001F9684
		private void ShowGroup(XChatView.ChatGroupState state)
		{
			bool flag = state == XChatView.ChatGroupState.GROUPS;
			base.uiBehaviour.m_sprGroupBack.SetVisible(!flag);
			base.uiBehaviour.m_sprGroupBind.SetVisible(!flag);
			base.uiBehaviour.m_sprGroupClear.SetVisible(flag);
			base.uiBehaviour.m_sprGroupQuit.SetVisible(!flag);
			base.uiBehaviour.m_sprMore.SetVisible(!flag);
			base.uiBehaviour.m_lblGroupChat.SetVisible(!flag);
			base.uiBehaviour.m_sprGroupCreate.SetVisible(flag);
			this.m_uiBehaviour.m_friendView.gameobject.SetActive(false);
			base.uiBehaviour.m_loopView.gameobject.SetActive(!flag);
			base.uiBehaviour.m_TextBoard.SetVisible(!flag);
			this.m_uiBehaviour.m_groupView.gameobject.SetActive(flag);
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			base.uiBehaviour.m_sprMember.SetVisible(!flag && specificDocument.currGroup != null && specificDocument.currGroup.captain);
			base.uiBehaviour.m_sprList.SetVisible(!flag && specificDocument.currGroup != null && !specificDocument.currGroup.captain);
			bool flag2 = specificDocument.currGroup != null;
			if (flag2)
			{
				base.uiBehaviour.m_lblGroupChat.SetText(XStringDefineProxy.GetString("CHAT_GROUP_SIGN", new object[]
				{
					specificDocument.currGroup.name
				}));
			}
		}

		// Token: 0x0600AC5A RID: 44122 RVA: 0x001FB628 File Offset: 0x001F9828
		public void OnFocus()
		{
			for (int i = 0; i < 11; i++)
			{
				bool flag = this.showChannelIds[i] == ChatChannelType.Group;
				if (flag)
				{
					this.mCheckbox[i].ForceSetFlag(true);
					break;
				}
			}
		}

		// Token: 0x0600AC5B RID: 44123 RVA: 0x001FB66C File Offset: 0x001F986C
		public void ProcessGroupMsg()
		{
			bool flag = base.IsVisible() && this.activeChannelType == ChatChannelType.Group;
			if (flag)
			{
				bool flag2 = this.groupState == XChatView.ChatGroupState.GROUPS;
				if (flag2)
				{
					this.RefreshGrouplist();
				}
				else
				{
					this.JumpToGrouplist(null);
				}
			}
		}

		// Token: 0x0600AC5C RID: 44124 RVA: 0x001FB6B3 File Offset: 0x001F98B3
		private void JumpToGrouplist(IXUISprite spr)
		{
			this.ShowGroup(XChatView.ChatGroupState.GROUPS);
			this.RefreshGrouplist();
		}

		// Token: 0x0600AC5D RID: 44125 RVA: 0x001FB6C5 File Offset: 0x001F98C5
		public void JumpToGroupChat(IXUISprite spr)
		{
			this.groupState = XChatView.ChatGroupState.CHATS;
			this.ShowGroup(XChatView.ChatGroupState.CHATS);
			this.ShowMore(false);
			this.RefreshLoopScroll(ChatChannelType.Group);
		}

		// Token: 0x0600AC5E RID: 44126 RVA: 0x001FB6EC File Offset: 0x001F98EC
		private void OnMoreClick(IXUISprite spr)
		{
			bool flag = base.uiBehaviour.m_sprGroupQuit.IsVisible();
			this.ShowMore(!flag);
		}

		// Token: 0x0600AC5F RID: 44127 RVA: 0x001FB718 File Offset: 0x001F9918
		private void ShowMore(bool show)
		{
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			bool flag = false;
			bool flag2 = specificDocument.currGroup != null;
			if (flag2)
			{
				flag = specificDocument.currGroup.captain;
			}
			base.uiBehaviour.m_sprMember.gameObject.SetActive(show && flag);
			base.uiBehaviour.m_sprList.gameObject.SetActive(show && !flag);
			base.uiBehaviour.m_sprGroupQuit.gameObject.SetActive(show);
		}

		// Token: 0x0600AC60 RID: 44128 RVA: 0x001FB79C File Offset: 0x001F999C
		private void OnMemberClick(IXUISprite spr)
		{
			DlgBase<ChatGroupList, ChatGroupBehaviour>.singleton.SetVisible(true, true);
		}

		// Token: 0x0600AC61 RID: 44129 RVA: 0x001FB7AC File Offset: 0x001F99AC
		private void OnGroupClearClick(IXUISprite spr)
		{
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			specificDocument.ReqClearGroup();
			bool flag = specificDocument.groups != null;
			if (flag)
			{
				specificDocument.groups.Clear();
			}
			this.RefreshGrouplist();
		}

		// Token: 0x0600AC62 RID: 44130 RVA: 0x001FB7EC File Offset: 0x001F99EC
		private void OnListClick(IXUISprite spr)
		{
			DlgBase<ChatMemberList, ChatMemberBehaviour>.singleton.SetVisible(true, true);
		}

		// Token: 0x0600AC63 RID: 44131 RVA: 0x001FB7FC File Offset: 0x001F99FC
		private bool IsGroupWith(ChatInfo data)
		{
			bool flag = DlgBase<XChatView, XChatBehaviour>.singleton.IsVisible() && DlgBase<XChatView, XChatBehaviour>.singleton.activeChannelType == ChatChannelType.Group && this._friendState == XChatView.ChatFriendState.CHATS;
			return flag && data.group != null && this.ChatGroupId == data.group.groupchatID;
		}

		// Token: 0x0600AC64 RID: 44132 RVA: 0x001FB85C File Offset: 0x001F9A5C
		public bool HasNewGroupMsg()
		{
			this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			List<ChatInfo> chatInfoList = this._doc.GetChatInfoList(ChatChannelType.Group);
			bool flag = chatInfoList != null;
			if (flag)
			{
				for (int i = 0; i < chatInfoList.Count; i++)
				{
					bool flag2 = !this.IsGroupWith(chatInfoList[i]) && !chatInfoList[i].isUIShowed && !chatInfoList[i].isSelfSender;
					if (flag2)
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x0600AC65 RID: 44133 RVA: 0x001FB8EC File Offset: 0x001F9AEC
		public bool HasRedpointGroupMsg(ulong groupid)
		{
			List<ChatInfo> groupChatInfoList = this._doc.GetGroupChatInfoList(DlgBase<XChatView, XChatBehaviour>.singleton.ChatGroupId);
			bool flag = groupChatInfoList != null;
			if (flag)
			{
				for (int i = 0; i < groupChatInfoList.Count; i++)
				{
					bool flag2 = !groupChatInfoList[i].isUIShowed && !groupChatInfoList[i].isSelfSender;
					if (flag2)
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x0600AC66 RID: 44134 RVA: 0x001FB964 File Offset: 0x001F9B64
		private void OnGroupBindClick(IXUISprite spr)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
			string @string = XStringDefineProxy.GetString("CHAT_CLEAR");
			string string2 = XStringDefineProxy.GetString(XStringDefine.COMMON_OK);
			string string3 = XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(@string, string2, string3);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnOKClearGroups), null);
		}

		// Token: 0x0600AC67 RID: 44135 RVA: 0x001FB9CC File Offset: 0x001F9BCC
		private bool OnOKClearGroups(IXUIButton btn)
		{
			return true;
		}

		// Token: 0x0600AC68 RID: 44136 RVA: 0x001FB9E0 File Offset: 0x001F9BE0
		public void OnGroupQuitClick(IXUISprite spr)
		{
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			CBrifGroupInfo currGroup = specificDocument.currGroup;
			bool flag = currGroup == null;
			if (!flag)
			{
				bool captain = currGroup.captain;
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
				string key = captain ? "CHAT_GROUP_QUIT1" : "CHAT_GROUP_QUIT2";
				string @string = XStringDefineProxy.GetString(key);
				string string2 = XStringDefineProxy.GetString(XStringDefine.COMMON_OK);
				string string3 = XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL);
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(@string, string2, string3);
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnModalDlgOK), null);
			}
		}

		// Token: 0x0600AC69 RID: 44137 RVA: 0x001FBA7D File Offset: 0x001F9C7D
		private void OnGroupBackClick(IXUISprite spr)
		{
			this.JumpToGrouplist(spr);
		}

		// Token: 0x0600AC6A RID: 44138 RVA: 0x001FBA88 File Offset: 0x001F9C88
		private void OnGroupCreateClick(IXUISprite spr)
		{
			DlgBase<CreateChatGroupDlg, CreateChatGroupBehaviour>.singleton.SetVisible(true, true);
			DlgBase<CreateChatGroupDlg, CreateChatGroupBehaviour>.singleton.SetCallBack(new CreatechatGroupCall(this.OnCreateGroup));
		}

		// Token: 0x0600AC6B RID: 44139 RVA: 0x001FBAB0 File Offset: 0x001F9CB0
		private bool OnCreateGroup(string groupname)
		{
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			return specificDocument.ReqCreateGroupChat(groupname, 1U);
		}

		// Token: 0x0600AC6C RID: 44140 RVA: 0x001FBAD8 File Offset: 0x001F9CD8
		private bool OnModalDlgOK(IXUIButton btn)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			this.groupState = XChatView.ChatGroupState.GROUPS;
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			CBrifGroupInfo currGroup = specificDocument.currGroup;
			bool flag = currGroup == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("quit group id is null", null, null, null, null, null);
			}
			specificDocument.ReqQuitGroup(currGroup.id);
			return true;
		}

		// Token: 0x1700307D RID: 12413
		// (get) Token: 0x0600AC6D RID: 44141 RVA: 0x001FBB3C File Offset: 0x001F9D3C
		// (set) Token: 0x0600AC6E RID: 44142 RVA: 0x001FBB54 File Offset: 0x001F9D54
		public XChatView.ChatFriendState friendState
		{
			get
			{
				return this._friendState;
			}
			set
			{
				this.ShowFriend(value == XChatView.ChatFriendState.FRIENDS);
				this._friendState = value;
			}
		}

		// Token: 0x0600AC6F RID: 44143 RVA: 0x001FBB6C File Offset: 0x001F9D6C
		private void RegistFriendEvent()
		{
			base.uiBehaviour.m_sprFriendAdd.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnAddFriendClick));
			base.uiBehaviour.m_sprFriendBack.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.JumpToFriends));
			base.uiBehaviour.m_sprFriendClear.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClearFriendClick));
			base.uiBehaviour.m_sprFriendChat.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.ShowFriendsUI));
		}

		// Token: 0x0600AC70 RID: 44144 RVA: 0x001FBBF0 File Offset: 0x001F9DF0
		private void RefreshFriendList()
		{
			List<ChatFriendData> friends = this._doc.FetchFriendsIcons();
			this.RefreshFriendsScroll(friends);
		}

		// Token: 0x0600AC71 RID: 44145 RVA: 0x001FBC12 File Offset: 0x001F9E12
		public void RefreshFriendUI()
		{
			this.RefreshFriendUI(this.friendState);
		}

		// Token: 0x0600AC72 RID: 44146 RVA: 0x001FBC24 File Offset: 0x001F9E24
		public void RefreshFriendUI(XChatView.ChatFriendState _state)
		{
			bool flag = this.ChatFriendId == 0UL || this._doc.ChatFriendList.Count <= 0 || _state == XChatView.ChatFriendState.FRIENDS;
			if (flag)
			{
				this.friendState = XChatView.ChatFriendState.FRIENDS;
				this.RefreshFriendList();
			}
			else
			{
				this.friendState = XChatView.ChatFriendState.CHATS;
				this.RefreshLoopScroll(ChatChannelType.Friends);
			}
		}

		// Token: 0x0600AC73 RID: 44147 RVA: 0x001FBC7D File Offset: 0x001F9E7D
		private void OnAddFriendClick(IXUISprite spr)
		{
			DlgBase<XFriendsView, XFriendsBehaviour>.singleton.AddFriendById(this.ChatFriendId);
		}

		// Token: 0x0600AC74 RID: 44148 RVA: 0x001FBC94 File Offset: 0x001F9E94
		private void OnClearFriendClick(IXUISprite spr)
		{
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.uiBehaviour.m_OKButton.ID = 0UL;
			string @string = XStringDefineProxy.GetString("CHAT_CLEAR");
			string string2 = XStringDefineProxy.GetString(XStringDefine.COMMON_OK);
			string string3 = XStringDefineProxy.GetString(XStringDefine.COMMON_CANCEL);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(@string, string2, string3);
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(new ButtonClickEventHandler(this.OnOKClearFriends), null);
		}

		// Token: 0x0600AC75 RID: 44149 RVA: 0x001FBD14 File Offset: 0x001F9F14
		private bool OnOKClearFriends(IXUIButton btn)
		{
			ulong id = btn.ID;
			this.OnSendClearFriend(id);
			return true;
		}

		// Token: 0x0600AC76 RID: 44150 RVA: 0x001FBD38 File Offset: 0x001F9F38
		public void OnSendClearFriend(ulong uid)
		{
			this.ChatFriendId = 0UL;
			this._doc.ClearFriendMsg(uid);
			this.RefreshFriendUI(XChatView.ChatFriendState.FRIENDS);
			this.ShowTabFriendRed();
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
			RpcC2M_ClearPrivateChatList rpcC2M_ClearPrivateChatList = new RpcC2M_ClearPrivateChatList();
			rpcC2M_ClearPrivateChatList.oArg.roleid = uid;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2M_ClearPrivateChatList);
		}

		// Token: 0x0600AC77 RID: 44151 RVA: 0x001FBD98 File Offset: 0x001F9F98
		private void ShowFriendsUI(IXUISprite spr)
		{
			bool flag = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Friends);
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FRIEND_UI_LOCK"), "fece00");
			}
			else
			{
				XSingleton<XGameSysMgr>.singleton.OpenSystem(XSysDefine.XSys_Friends, 0UL);
			}
		}

		// Token: 0x0600AC78 RID: 44152 RVA: 0x001FBDE8 File Offset: 0x001F9FE8
		private void JumpToFriends(IXUISprite spr)
		{
			this.friendState = XChatView.ChatFriendState.FRIENDS;
			this.RefreshFriendUI();
			this.ShowFriend(true);
		}

		// Token: 0x0600AC79 RID: 44153 RVA: 0x001FBE02 File Offset: 0x001FA002
		public void JumpToChats(IXUISprite spr)
		{
			this.friendState = XChatView.ChatFriendState.CHATS;
			this.ChatFriendId = spr.ID;
			this.ResetRedpointMsg(DlgBase<XChatView, XChatBehaviour>.singleton.ChatFriendId);
			this.ShowTabFriendRed();
			this.ShowFriend(false);
			this.RefreshLoopScroll(ChatChannelType.Friends);
		}

		// Token: 0x0600AC7A RID: 44154 RVA: 0x001FBE44 File Offset: 0x001FA044
		private void ShowFriend(bool isFriends)
		{
			ulong chatFriendId = DlgBase<XChatView, XChatBehaviour>.singleton.ChatFriendId;
			bool flag = chatFriendId > 0UL && DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsMyFriend(chatFriendId);
			this.m_uiBehaviour.m_friendView.gameobject.SetActive(isFriends);
			this.m_uiBehaviour.m_loopView.gameobject.SetActive(!isFriends);
			base.uiBehaviour.m_groupView.gameobject.SetActive(false);
			base.uiBehaviour.m_TextBoard.SetVisible(!isFriends);
			this.m_uiBehaviour.m_sprFriendAdd.SetVisible(!isFriends && !flag);
			this.m_uiBehaviour.m_sprFriendClear.SetVisible(isFriends && this._doc.ChatFriendList.Count > 0);
			this.m_uiBehaviour.m_sprFriendBack.SetVisible(!isFriends);
			this.m_uiBehaviour.m_lblFriendTip.SetVisible(!isFriends);
			this.m_uiBehaviour.m_sprFriendChat.SetVisible(isFriends && this._doc.ChatFriendList.Count <= 0);
			bool flag2 = !isFriends;
			if (flag2)
			{
				ChatFriendData currChatFriendData = this.UIOP.CurrChatFriendData;
				bool flag3 = currChatFriendData != null;
				if (flag3)
				{
					this.m_uiBehaviour.m_lblFriendTip.SetText(XStringDefineProxy.GetString("CHAT_WITH", new object[]
					{
						currChatFriendData.name
					}));
				}
			}
		}

		// Token: 0x0600AC7B RID: 44155 RVA: 0x001FBFB4 File Offset: 0x001FA1B4
		public void ResetRedpointMsg(ulong uid)
		{
			bool flag = this._doc == null;
			if (flag)
			{
				this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			}
			List<ChatInfo> friendChatInfoList = this._doc.GetFriendChatInfoList(uid);
			for (int i = 0; i < friendChatInfoList.Count; i++)
			{
				friendChatInfoList[i].isUIShowed = true;
			}
			for (int j = 0; j < this._doc.ChatFriendList.Count; j++)
			{
				bool flag2 = this._doc.ChatFriendList[j].roleid == uid;
				if (flag2)
				{
					this._doc.ChatFriendList[j].hasOfflineRead = false;
					break;
				}
			}
		}

		// Token: 0x0600AC7C RID: 44156 RVA: 0x001FC074 File Offset: 0x001FA274
		public bool HasRedpointMsg(ulong uid)
		{
			this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			List<ChatFriendData> chatFriendList = this._doc.ChatFriendList;
			for (int i = 0; i < chatFriendList.Count; i++)
			{
				bool flag = chatFriendList[i].roleid == uid && chatFriendList[i].hasOfflineRead;
				if (flag)
				{
					return true;
				}
			}
			List<ChatInfo> friendChatInfoList = this._doc.GetFriendChatInfoList(uid);
			for (int j = 0; j < friendChatInfoList.Count; j++)
			{
				bool flag2 = !friendChatInfoList[j].isUIShowed && !friendChatInfoList[j].isSelfSender;
				if (flag2)
				{
					return true;
				}
			}
			return false;
		}

		// Token: 0x0600AC7D RID: 44157 RVA: 0x001FC13C File Offset: 0x001FA33C
		private bool IsChatWith(ChatInfo data)
		{
			bool flag = DlgBase<XChatView, XChatBehaviour>.singleton.IsVisible() && DlgBase<XChatView, XChatBehaviour>.singleton.activeChannelType == ChatChannelType.Friends && this._friendState == XChatView.ChatFriendState.CHATS;
			return flag && (this.ChatFriendId == data.mReceiverId || this.ChatFriendId == data.mSenderId);
		}

		// Token: 0x0600AC7E RID: 44158 RVA: 0x001FC19C File Offset: 0x001FA39C
		private bool IsInFriendsList(ChatInfo data, List<ChatFriendData> friends)
		{
			for (int i = 0; i < friends.Count; i++)
			{
				ulong roleid = friends[i].roleid;
				ulong num = data.isSelfSender ? data.mReceiverId : data.mSenderId;
				bool flag = roleid == num;
				if (flag)
				{
					return true;
				}
			}
			return false;
		}

		// Token: 0x0600AC7F RID: 44159 RVA: 0x001FC1FC File Offset: 0x001FA3FC
		public bool HasNewFriendMsg()
		{
			this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			List<ChatFriendData> chatFriendList = this._doc.ChatFriendList;
			for (int i = 0; i < chatFriendList.Count; i++)
			{
				bool hasOfflineRead = chatFriendList[i].hasOfflineRead;
				if (hasOfflineRead)
				{
					return true;
				}
			}
			List<ChatInfo> chatInfoList = this._doc.GetChatInfoList(ChatChannelType.Friends);
			bool flag = chatInfoList != null;
			if (flag)
			{
				for (int j = 0; j < chatInfoList.Count; j++)
				{
					bool flag2 = !this.IsChatWith(chatInfoList[j]) && !chatInfoList[j].isUIShowed && !chatInfoList[j].isSelfSender && this.IsInFriendsList(chatInfoList[j], chatFriendList);
					if (flag2)
					{
						return true;
					}
				}
			}
			return false;
		}

		// Token: 0x0600AC80 RID: 44160 RVA: 0x001FC2E0 File Offset: 0x001FA4E0
		private void LoopInit()
		{
			GameObject tpl = base.uiBehaviour.m_loopView.GetTpl();
			bool flag = tpl != null && tpl.GetComponent<ChatItem>() == null;
			if (flag)
			{
				tpl.AddComponent<ChatItem>();
			}
			tpl = base.uiBehaviour.m_systemView.GetTpl();
			bool flag2 = tpl != null && tpl.GetComponent<ChatSystemItem>() == null;
			if (flag2)
			{
				tpl.AddComponent<ChatSystemItem>();
			}
			tpl = base.uiBehaviour.m_friendView.GetTpl();
			bool flag3 = tpl != null && tpl.GetComponent<ChatFriendItem>() == null;
			if (flag3)
			{
				tpl.AddComponent<ChatFriendItem>();
			}
			tpl = base.uiBehaviour.m_groupView.GetTpl();
			bool flag4 = tpl != null && tpl.GetComponent<ChatGroupItem>() == null;
			if (flag4)
			{
				tpl.AddComponent<ChatGroupItem>();
			}
		}

		// Token: 0x0600AC81 RID: 44161 RVA: 0x001FC3C8 File Offset: 0x001FA5C8
		private void SetLoopActive(ChatChannelType type)
		{
			base.uiBehaviour.m_systemView.gameobject.SetActive(type == ChatChannelType.System);
			bool flag = type != ChatChannelType.Friends;
			if (flag)
			{
				base.uiBehaviour.m_loopView.gameobject.SetActive(type != ChatChannelType.System);
				base.uiBehaviour.m_friendView.gameobject.SetActive(false);
				base.uiBehaviour.m_groupView.gameobject.SetActive(false);
				bool flag2 = type != ChatChannelType.System;
				if (flag2)
				{
					base.uiBehaviour.m_loopView.ResetScroll();
				}
			}
			float num = (float)((type == ChatChannelType.Friends || type == ChatChannelType.Group || this.IsVoicebarShow()) ? -24 : 0);
			base.uiBehaviour.m_tranOffset.localPosition = new Vector3(0f, num, 0f);
		}

		// Token: 0x0600AC82 RID: 44162 RVA: 0x001FC4A0 File Offset: 0x001FA6A0
		public void RefreshLoopScroll(ChatChannelType type)
		{
			bool flag = base.IsVisible();
			if (flag)
			{
				bool flag2 = type == ChatChannelType.Friends;
				if (flag2)
				{
					bool flag3 = this.friendState == XChatView.ChatFriendState.CHATS;
					if (flag3)
					{
						List<ChatInfo> friendChatInfoList = this._doc.GetFriendChatInfoList(DlgBase<XChatView, XChatBehaviour>.singleton.ChatFriendId);
						base.uiBehaviour.m_loopView.SetClipSize(new Vector2(434f, 504f));
						this.RefreshLoopScroll(type, friendChatInfoList);
						this.cacheChannelType = type;
					}
					else
					{
						this.friendState = XChatView.ChatFriendState.FRIENDS;
						this.RefreshFriendList();
					}
				}
				else
				{
					bool flag4 = type == ChatChannelType.Group;
					if (flag4)
					{
						bool flag5 = this.groupState == XChatView.ChatGroupState.CHATS;
						if (flag5)
						{
							List<ChatInfo> groupChatInfoList = this._doc.GetGroupChatInfoList(DlgBase<XChatView, XChatBehaviour>.singleton.ChatGroupId);
							base.uiBehaviour.m_loopView.SetClipSize(new Vector2(434f, 504f));
							this.RefreshLoopScroll(type, groupChatInfoList);
							this.cacheChannelType = type;
						}
						else
						{
							this.groupState = XChatView.ChatGroupState.GROUPS;
						}
					}
					else
					{
						bool flag6 = type == ChatChannelType.System;
						if (flag6)
						{
							List<ChatInfo> chatInfoList = this._doc.GetChatInfoList(type);
							this.RefreshSystemScroll(chatInfoList);
						}
						else
						{
							List<ChatInfo> chatInfoList2 = this._doc.GetChatInfoList(type);
							base.uiBehaviour.m_loopView.SetClipSize(this.IsVoicebarShow() ? new Vector2(434f, 504f) : new Vector2(434f, 544f));
							this.RefreshLoopScroll(type, chatInfoList2);
							this.cacheChannelType = type;
						}
					}
				}
			}
		}

		// Token: 0x0600AC83 RID: 44163 RVA: 0x001FC628 File Offset: 0x001FA828
		private void RefreshLoopScroll(ChatChannelType type, List<ChatInfo> chats)
		{
			List<LoopItemData> list = new List<LoopItemData>();
			bool flag = chats != null;
			if (flag)
			{
				for (int i = 0; i < chats.Count; i++)
				{
					chats[i].LoopID = XSingleton<XCommon>.singleton.XHash(XSingleton<XCommon>.singleton.StringCombine(chats[i].mContent, chats[i].mSenderPaymemberid.ToString()));
					list.Add(chats[i]);
				}
			}
			this.cacheLoopList = list;
			bool flag2 = base.uiBehaviour.m_loopView.IsScrollLast() || this.cacheChannelType != type || this.cacheChannelType == ChatChannelType.Friends || this.cacheChannelType == ChatChannelType.Group;
			if (flag2)
			{
				bool activeInHierarchy = base.uiBehaviour.m_loopView.gameobject.activeInHierarchy;
				if (activeInHierarchy)
				{
					base.uiBehaviour.m_loopView.Init(list, new DelegateHandler(this.RefreshItem), new Action(this.OnDragFinish), (list.Count > 5) ? 1 : 0, false);
				}
			}
		}

		// Token: 0x0600AC84 RID: 44164 RVA: 0x001FC73C File Offset: 0x001FA93C
		private void OnDragFinish()
		{
			base.uiBehaviour.m_loopView.Init(this.cacheLoopList, new DelegateHandler(this.RefreshItem), new Action(this.OnDragFinish), (this.cacheLoopList.Count > 5) ? 1 : 0, false);
		}

		// Token: 0x0600AC85 RID: 44165 RVA: 0x001FC78C File Offset: 0x001FA98C
		private void RefreshFriendsScroll(List<ChatFriendData> friends)
		{
			List<LoopItemData> list = new List<LoopItemData>();
			bool flag = friends != null;
			if (flag)
			{
				for (int i = 0; i < friends.Count; i++)
				{
					list.Add(new ChatFriendData
					{
						isfriend = friends[i].isfriend,
						name = friends[i].name,
						powerpoint = friends[i].powerpoint,
						profession = friends[i].profession,
						roleid = friends[i].roleid,
						msgtime = friends[i].msgtime,
						viplevel = friends[i].viplevel,
						setid = friends[i].setid,
						LoopID = XSingleton<XCommon>.singleton.XHash(friends[i].name + Time.unscaledTime.ToString())
					});
				}
			}
			base.uiBehaviour.m_friendView.Init(list, new DelegateHandler(this.RefreshFriendItem), null, 0, false);
		}

		// Token: 0x0600AC86 RID: 44166 RVA: 0x001FC8BC File Offset: 0x001FAABC
		private void RefreshGrouplist()
		{
			GroupChatDocument specificDocument = XDocuments.GetSpecificDocument<GroupChatDocument>(GroupChatDocument.uuID);
			HashSet<CBrifGroupInfo> groups = specificDocument.groups;
			bool flag = groups != null;
			if (flag)
			{
				List<LoopItemData> list = new List<LoopItemData>();
				foreach (CBrifGroupInfo item in groups)
				{
					list.Add(item);
				}
				list.Sort(new Comparison<LoopItemData>(this.SortGroup));
				base.uiBehaviour.m_groupView.Init(list, new DelegateHandler(this.RefreshGroupItem), null, 0, true);
			}
		}

		// Token: 0x0600AC87 RID: 44167 RVA: 0x001FC948 File Offset: 0x001FAB48
		private int SortGroup(LoopItemData x, LoopItemData y)
		{
			CBrifGroupInfo cbrifGroupInfo = x as CBrifGroupInfo;
			CBrifGroupInfo cbrifGroupInfo2 = y as CBrifGroupInfo;
			return cbrifGroupInfo.createTime.CompareTo(cbrifGroupInfo2.createTime);
		}

		// Token: 0x0600AC88 RID: 44168 RVA: 0x001FC97C File Offset: 0x001FAB7C
		private void RefreshSystemScroll(List<ChatInfo> chats)
		{
			List<LoopItemData> list = new List<LoopItemData>();
			bool flag = chats != null;
			if (flag)
			{
				for (int i = 0; i < chats.Count; i++)
				{
					chats[i].LoopID = XSingleton<XCommon>.singleton.XHash(chats[i].mContent);
					list.Add(chats[i]);
				}
			}
			base.uiBehaviour.m_systemView.Init(list, new DelegateHandler(this.RefreshSystemItem), null, (list.Count > 5) ? 1 : 0, false);
		}

		// Token: 0x0600AC89 RID: 44169 RVA: 0x001FCA10 File Offset: 0x001FAC10
		private void RefreshItem(ILoopItemObject item, LoopItemData data)
		{
			ChatInfo chatInfo = data as ChatInfo;
			bool flag = chatInfo != null;
			if (flag)
			{
				item.GetObj().GetComponent<ChatItem>().Refresh(chatInfo);
			}
			else
			{
				XSingleton<XDebug>.singleton.AddErrorLog("info is nil", null, null, null, null, null);
			}
		}

		// Token: 0x0600AC8A RID: 44170 RVA: 0x001FCA58 File Offset: 0x001FAC58
		private void RefreshFriendItem(ILoopItemObject item, LoopItemData data)
		{
			ChatFriendData chatFriendData = data as ChatFriendData;
			bool flag = chatFriendData != null;
			if (flag)
			{
				item.GetObj().GetComponent<ChatFriendItem>().Refresh(chatFriendData);
			}
			else
			{
				XSingleton<XDebug>.singleton.AddErrorLog("friend info is null", null, null, null, null, null);
			}
		}

		// Token: 0x0600AC8B RID: 44171 RVA: 0x001FCAA0 File Offset: 0x001FACA0
		private void RefreshGroupItem(ILoopItemObject item, LoopItemData data)
		{
			CBrifGroupInfo cbrifGroupInfo = data as CBrifGroupInfo;
			bool flag = cbrifGroupInfo != null;
			if (flag)
			{
				item.GetObj().GetComponent<ChatGroupItem>().Refresh(cbrifGroupInfo);
			}
			else
			{
				XSingleton<XDebug>.singleton.AddErrorLog("group info is null", null, null, null, null, null);
			}
		}

		// Token: 0x0600AC8C RID: 44172 RVA: 0x001FCAE8 File Offset: 0x001FACE8
		private void RefreshSystemItem(ILoopItemObject item, LoopItemData data)
		{
			ChatInfo chatInfo = data as ChatInfo;
			bool flag = chatInfo != null;
			if (flag)
			{
				item.GetObj().GetComponent<ChatSystemItem>().Refresh(chatInfo);
			}
			else
			{
				XSingleton<XDebug>.singleton.AddErrorLog("system info is nil", null, null, null, null, null);
			}
		}

		// Token: 0x1700307E RID: 12414
		// (get) Token: 0x0600AC8D RID: 44173 RVA: 0x001FCB30 File Offset: 0x001FAD30
		private bool isFighting
		{
			get
			{
				return XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World || XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_BIGMELEE_READY;
			}
		}

		// Token: 0x0600AC8E RID: 44174 RVA: 0x001FCB68 File Offset: 0x001FAD68
		private void InitTabs()
		{
			for (int i = 0; i < 11; i++)
			{
				int num = (int)this.showChannelIds[i];
				Transform transform = base.uiBehaviour.transform.Find("Bg/tabs/tab" + num);
				this.mTransTab[i] = transform;
				IXUICheckBox ixuicheckBox = transform.Find("template/Bg").GetComponent("XUICheckBox") as IXUICheckBox;
				this.mCheckbox[i] = ixuicheckBox;
			}
		}

		// Token: 0x0600AC8F RID: 44175 RVA: 0x001FCBE4 File Offset: 0x001FADE4
		private void ResetTabs()
		{
			for (int i = 0; i < this.mCheckbox.Length; i++)
			{
				this.mCheckbox[i].bChecked = false;
			}
		}

		// Token: 0x0600AC90 RID: 44176 RVA: 0x001FCC1C File Offset: 0x001FAE1C
		private void SetDepth()
		{
			int num = 16;
			XTeamDocument specificDocument = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
			bool flag = specificDocument != null && specificDocument.MyTeamView != null && specificDocument.MyTeamView.IsVisible();
			if (flag)
			{
				num = 13;
			}
			base.uiBehaviour.m_panelText.SetDepth(num + 1);
			base.uiBehaviour.m_panelRoot.SetDepth(num);
			base.uiBehaviour.m_loopView.SetDepth(num + 1);
			base.uiBehaviour.m_friendView.SetDepth(num + 1);
			base.uiBehaviour.m_systemView.SetDepth(num + 1);
			base.uiBehaviour.m_panelSubMenu.SetDepth(num + 2);
		}

		// Token: 0x0600AC91 RID: 44177 RVA: 0x001FCCD0 File Offset: 0x001FAED0
		private void ShowTextboard(ChatChannelType channel)
		{
			bool flag = channel == ChatChannelType.World && !this.ChatDoc.CheckLevelLimit(channel);
			if (flag)
			{
				base.uiBehaviour.m_TextBoard.SetVisible(false);
				base.uiBehaviour.m_LimitBoard.SetVisible(true);
			}
			else
			{
				base.uiBehaviour.m_LimitBoard.SetVisible(false);
				base.uiBehaviour.m_TextBoard.SetVisible(channel != ChatChannelType.System);
			}
		}

		// Token: 0x0600AC92 RID: 44178 RVA: 0x001FCD4C File Offset: 0x001FAF4C
		private void ShowTabs()
		{
			int num = 0;
			IXUISprite ixuisprite = base.uiBehaviour.transform.Find("Bg/tabs/tab1").GetComponent("XUISprite") as IXUISprite;
			int spriteHeight = ixuisprite.spriteHeight;
			int i = 0;
			while (i < 11)
			{
				ChatChannelType chatChannelType = this.showChannelIds[i];
				Transform transform = base.uiBehaviour.transform.Find("Bg/tabs/tab" + (int)chatChannelType);
				bool flag = transform != null;
				if (flag)
				{
					bool flag2 = chatChannelType == ChatChannelType.Guild;
					if (flag2)
					{
						bool flag3 = this.CheckGuildOpen();
						this.mCheckbox[i].ForceSetFlag(false);
						transform.gameObject.SetActive(flag3);
						bool flag4 = !flag3 && this.activeChannelType == ChatChannelType.Guild;
						if (flag4)
						{
							this.activeChannelType = ChatChannelType.World;
						}
						bool flag5 = !flag3;
						if (flag5)
						{
							goto IL_4B2;
						}
					}
					else
					{
						bool flag6 = chatChannelType == ChatChannelType.Team;
						if (flag6)
						{
							bool flag7 = this.CheckTeamOpen();
							this.mCheckbox[i].ForceSetFlag(false);
							transform.gameObject.SetActive(flag7);
							bool flag8 = !flag7 && this.activeChannelType == ChatChannelType.Team;
							if (flag8)
							{
								this.activeChannelType = ChatChannelType.World;
							}
							bool flag9 = !flag7;
							if (flag9)
							{
								goto IL_4B2;
							}
						}
						else
						{
							bool flag10 = chatChannelType == ChatChannelType.Friends;
							if (flag10)
							{
								transform.gameObject.SetActive(!this.isFighting);
								bool isFighting = this.isFighting;
								if (isFighting)
								{
									bool flag11 = this.activeChannelType == ChatChannelType.Friends;
									if (flag11)
									{
										this.activeChannelType = ChatChannelType.World;
									}
									goto IL_4B2;
								}
							}
							else
							{
								bool flag12 = chatChannelType == ChatChannelType.Spectate;
								if (flag12)
								{
									bool flag13 = DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsVisible();
									this.mCheckbox[i].ForceSetFlag(false);
									transform.gameObject.SetActive(flag13);
									bool flag14 = !flag13;
									if (flag14)
									{
										bool flag15 = this.activeChannelType == ChatChannelType.Spectate;
										if (flag15)
										{
											this.activeChannelType = ChatChannelType.World;
										}
										goto IL_4B2;
									}
								}
								else
								{
									bool flag16 = chatChannelType == ChatChannelType.Curr;
									if (flag16)
									{
										bool flag17 = !DlgBase<SpectateSceneView, SpectateSceneBehaviour>.singleton.IsVisible();
										bool flag18 = !flag17;
										if (flag18)
										{
											this.mCheckbox[i].bChecked = false;
										}
										transform.gameObject.SetActive(flag17);
										bool flag19 = !flag17;
										if (flag19)
										{
											bool flag20 = this.activeChannelType == ChatChannelType.Curr;
											if (flag20)
											{
												this.activeChannelType = ChatChannelType.World;
											}
											goto IL_4B2;
										}
									}
									else
									{
										bool flag21 = chatChannelType == ChatChannelType.Partner;
										if (flag21)
										{
											bool flag22 = this.CheckDragonGuildOpen();
											this.mCheckbox[i].ForceSetFlag(false);
											transform.gameObject.SetActive(flag22);
											bool flag23 = !flag22;
											if (flag23)
											{
												bool flag24 = this.activeChannelType == ChatChannelType.Partner;
												if (flag24)
												{
													this.activeChannelType = ChatChannelType.World;
												}
												goto IL_4B2;
											}
										}
										else
										{
											bool flag25 = chatChannelType == ChatChannelType.Battle;
											if (flag25)
											{
												bool flag26 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World && this.ChatDoc.GetBattleRaw().battle == 1;
												bool flag27 = !flag26;
												if (flag27)
												{
													this.mCheckbox[i].bChecked = false;
												}
												transform.gameObject.SetActive(flag26);
												bool flag28 = !flag26;
												if (flag28)
												{
													bool flag29 = this.activeChannelType == ChatChannelType.Battle;
													if (flag29)
													{
														this.activeChannelType = ChatChannelType.World;
													}
													goto IL_4B2;
												}
											}
											else
											{
												bool flag30 = chatChannelType == ChatChannelType.Broadcast;
												if (flag30)
												{
													this.mCheckbox[i].ForceSetFlag(false);
													XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
													int value = specificDocument.GetValue(XOptionsDefine.OD_RADIO);
													int @int = XSingleton<XGlobalConfig>.singleton.GetInt("RadioChatOpen");
													bool flag31 = (long)@int <= (long)((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level);
													bool flag32 = value == 1 && flag31;
													transform.gameObject.SetActive(flag32);
													bool flag33 = !flag32;
													if (flag33)
													{
														bool flag34 = this.activeChannelType == ChatChannelType.Broadcast;
														if (flag34)
														{
															this.activeChannelType = ChatChannelType.World;
														}
														goto IL_4B2;
													}
												}
												else
												{
													bool flag35 = chatChannelType == ChatChannelType.Group;
													if (flag35)
													{
														this.mCheckbox[i].ForceSetFlag(false);
														int int2 = XSingleton<XGlobalConfig>.singleton.GetInt("GroupChatOpen");
														bool flag36 = (long)int2 <= (long)((ulong)XSingleton<XAttributeMgr>.singleton.XPlayerData.Level);
														bool flag37 = flag36;
														transform.gameObject.SetActive(flag37);
														bool flag38 = !flag37;
														if (flag38)
														{
															bool flag39 = this.activeChannelType == ChatChannelType.Group;
															if (flag39)
															{
																this.activeChannelType = ChatChannelType.World;
															}
															goto IL_4B2;
														}
													}
												}
											}
										}
									}
								}
							}
						}
					}
					transform.transform.localPosition = new Vector3(0f, (float)(272 - spriteHeight * num), 0f);
					num++;
				}
				IL_4B2:
				i++;
				continue;
				//goto IL_4B2;
			}
		}

		// Token: 0x0600AC93 RID: 44179 RVA: 0x001FD220 File Offset: 0x001FB420
		public void ShowBtns()
		{
			bool flag = XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Mail);
			base.uiBehaviour.m_sprMail.SetVisible(!this.isFighting && flag);
			base.uiBehaviour.m_sprSet.SetVisible(!this.isFighting);
		}

		// Token: 0x0600AC94 RID: 44180 RVA: 0x001FD274 File Offset: 0x001FB474
		public void ShowMailRedpoint()
		{
			bool flag = base.IsVisible();
			if (flag)
			{
				bool sysRedPointState = XSingleton<XGameSysMgr>.singleton.GetSysRedPointState(XSysDefine.XSys_Mail);
				base.uiBehaviour.m_sprMailRedpoint.SetVisible(sysRedPointState);
			}
			bool flag2 = DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.ShowMailRedpoint();
			}
		}

		// Token: 0x0600AC95 RID: 44181 RVA: 0x001FD2C8 File Offset: 0x001FB4C8
		public void ShowTabFriendRed()
		{
			bool flag = this.HasNewFriendMsg();
			bool flag2 = DlgBase<XChatView, XChatBehaviour>.singleton.IsLoaded();
			if (flag2)
			{
				ChatChannelType chatChannelType = ChatChannelType.Friends;
				Transform transform = base.uiBehaviour.transform.Find("Bg/tabs/tab" + (int)chatChannelType);
				GameObject gameObject = transform.Find("template/Bg/redpoint").gameObject;
				bool flag3 = gameObject != null;
				if (flag3)
				{
					gameObject.SetActive(flag);
				}
			}
			bool flag4 = DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.IsVisible();
			if (flag4)
			{
				DlgBase<XChatSmallView, XChatSmallBehaviour>.singleton.SetRedpoint(flag);
			}
		}

		// Token: 0x0600AC96 RID: 44182 RVA: 0x001FD358 File Offset: 0x001FB558
		private bool CheckTeamOpen()
		{
			XTeamDocument specificDocument = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
			bool flag = specificDocument.MyTeam == null || specificDocument.MyTeam.teamBrief.teamID == 0;
			return !flag;
		}

		// Token: 0x0600AC97 RID: 44183 RVA: 0x001FD3A0 File Offset: 0x001FB5A0
		public bool CheckGuildOpen()
		{
			XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
			return specificDocument.bInGuild;
		}

		// Token: 0x0600AC98 RID: 44184 RVA: 0x001FD3C4 File Offset: 0x001FB5C4
		public bool CheckDragonGuildOpen()
		{
			XDragonGuildDocument specificDocument = XDocuments.GetSpecificDocument<XDragonGuildDocument>(XDragonGuildDocument.uuID);
			return specificDocument.IsInDragonGuild();
		}

		// Token: 0x0600AC99 RID: 44185 RVA: 0x001FD3E8 File Offset: 0x001FB5E8
		public void RegistLinkSend(string content, Action onSend)
		{
			this.mLinkContent = content;
			this.mInputType = InputUIType.Linked;
			this.mOnSend = onSend;
			XSingleton<XDebug>.singleton.AddLog("length: ", content.Length.ToString(), " content:", content, null, null, XDebugColor.XDebug_None);
			base.uiBehaviour.m_Input.SetText(content);
		}

		// Token: 0x0600AC9A RID: 44186 RVA: 0x001FD444 File Offset: 0x001FB644
		private void DispatchLinkClick()
		{
			bool flag = this.mOnSend != null;
			if (flag)
			{
				this.mOnSend();
			}
			this.mInputType = InputUIType.Normal;
			this.ResetInput();
		}

		// Token: 0x0600AC9B RID: 44187 RVA: 0x001FD47C File Offset: 0x001FB67C
		private void OnUIInputChanged(IXUIInput input)
		{
			bool flag = this.mInputType == InputUIType.Linked;
			if (flag)
			{
				bool flag2 = input.GetText().Length != this.mLinkContent.Length;
				if (flag2)
				{
					this.mInputType = InputUIType.Normal;
					this.ResetInput();
				}
			}
		}

		// Token: 0x0600AC9C RID: 44188 RVA: 0x001FD4C8 File Offset: 0x001FB6C8
		private void OnUIInputSubmit(IXUIInput input)
		{
			bool flag = Application.platform == RuntimePlatform.WindowsEditor;
			if (flag)
			{
				this.DoSendTextChat(null);
			}
		}

		// Token: 0x1700307F RID: 12415
		// (get) Token: 0x0600AC9D RID: 44189 RVA: 0x001FD4EC File Offset: 0x001FB6EC
		public XChatDocument ChatDoc
		{
			get
			{
				return XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			}
		}

		// Token: 0x17003080 RID: 12416
		// (get) Token: 0x0600AC9E RID: 44190 RVA: 0x001FD508 File Offset: 0x001FB708
		// (set) Token: 0x0600AC9F RID: 44191 RVA: 0x001FD520 File Offset: 0x001FB720
		public int ChatIdIndex
		{
			get
			{
				return this.m_ChatIdIndex;
			}
			set
			{
				this.m_ChatIdIndex = value;
			}
		}

		// Token: 0x17003081 RID: 12417
		// (get) Token: 0x0600ACA0 RID: 44192 RVA: 0x001FD52C File Offset: 0x001FB72C
		public bool IsInited
		{
			get
			{
				return this.Inited;
			}
		}

		// Token: 0x17003082 RID: 12418
		// (get) Token: 0x0600ACA1 RID: 44193 RVA: 0x001FD544 File Offset: 0x001FB744
		public XChatUIOP UIOP
		{
			get
			{
				return this.m_UIOP;
			}
		}

		// Token: 0x17003083 RID: 12419
		// (get) Token: 0x0600ACA2 RID: 44194 RVA: 0x001FD55C File Offset: 0x001FB75C
		// (set) Token: 0x0600ACA3 RID: 44195 RVA: 0x001FD574 File Offset: 0x001FB774
		public ChatChannelType CurrentSpeakChannel
		{
			get
			{
				return this.currentSpeakChannel;
			}
			set
			{
				this.currentSpeakChannel = value;
			}
		}

		// Token: 0x17003084 RID: 12420
		// (get) Token: 0x0600ACA4 RID: 44196 RVA: 0x001FD580 File Offset: 0x001FB780
		public override string fileName
		{
			get
			{
				return "GameSystem/ChatNewDlg";
			}
		}

		// Token: 0x17003085 RID: 12421
		// (get) Token: 0x0600ACA5 RID: 44197 RVA: 0x001FD598 File Offset: 0x001FB798
		// (set) Token: 0x0600ACA6 RID: 44198 RVA: 0x001FD5B0 File Offset: 0x001FB7B0
		public string PrivateChatCurrName
		{
			get
			{
				return this.m_sPrivateChatCurrName;
			}
			set
			{
				this.m_sPrivateChatCurrName = value;
			}
		}

		// Token: 0x17003086 RID: 12422
		// (get) Token: 0x0600ACA7 RID: 44199 RVA: 0x001FD5BC File Offset: 0x001FB7BC
		// (set) Token: 0x0600ACA8 RID: 44200 RVA: 0x001FD5EC File Offset: 0x001FB7EC
		public SetEffectInfo Info
		{
			get
			{
				bool flag = this.m_iSetEffectInfo == null;
				if (flag)
				{
					this.m_iSetEffectInfo = new SetEffectInfo();
				}
				return this.m_iSetEffectInfo;
			}
			set
			{
				this.m_iSetEffectInfo = value;
			}
		}

		// Token: 0x17003087 RID: 12423
		// (get) Token: 0x0600ACA9 RID: 44201 RVA: 0x001FD5F8 File Offset: 0x001FB7F8
		public override int group
		{
			get
			{
				return 1;
			}
		}

		// Token: 0x17003088 RID: 12424
		// (get) Token: 0x0600ACAA RID: 44202 RVA: 0x001FD60C File Offset: 0x001FB80C
		public uint worldSpeakTimes
		{
			get
			{
				XWelfareDocument specificDocument = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
				bool flag = specificDocument != null && specificDocument.PayMemberPrivilege != null;
				uint result;
				if (flag)
				{
					bool flag2 = specificDocument.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Court);
					int num = specificDocument.GetMemberPrivilegeConfig(MemberPrivilege.KingdomPrivilege_Court).ChatCount - specificDocument.PayMemberPrivilege.usedChatCount;
					result = (flag2 ? (this._worldSpeadTimes + (uint)num) : this._worldSpeadTimes);
				}
				else
				{
					result = this._worldSpeadTimes;
				}
				return result;
			}
		}

		// Token: 0x0600ACAB RID: 44203 RVA: 0x001FD680 File Offset: 0x001FB880
		protected override void Init()
		{
			this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			this._doc.ChatView = this;
			this.InitTabs();
			for (int i = 0; i < 11; i++)
			{
				ulong id = (ulong)((long)this.showChannelIds[i]);
				this.mCheckbox[i].RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.SelectChatChannel));
				this.mCheckbox[i].ID = id;
				bool flag = this.showChannelIds[i] == this.activeChannelType;
				if (flag)
				{
					this.mCheckbox[i].bChecked = true;
				}
			}
			this.LoopInit();
			XOptionsView singleton = DlgBase<XOptionsView, XOptionsBehaviour>.singleton;
			singleton.OnOptionClose = (Action)Delegate.Combine(singleton.OnOptionClose, new Action(this.RefreshVoiceBarStatus));
			this.mInputType = InputUIType.Normal;
			this.Inited = true;
		}

		// Token: 0x0600ACAC RID: 44204 RVA: 0x001FD758 File Offset: 0x001FB958
		public override void RegisterEvent()
		{
			base.uiBehaviour.m_ChangeToVoice.RegisterPressEventHandler(new ButtonPressEventHandler(this.OnVoiceChatButton));
			base.uiBehaviour.m_ChangeToVoice.RegisterDragEventHandler(new ButtonDragEventHandler(this.OnVoiceButtonDrag));
			base.uiBehaviour.m_DoSendChat.RegisterClickEventHandler(new ButtonClickEventHandler(this.DoSendTextChat));
			base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClicked));
			base.uiBehaviour.m_btnAdd.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnBtmAddClick));
			base.uiBehaviour.m_GetFlowerBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnGetFlower));
			this.RegistFriendEvent();
			this.RegistGroupEvent();
			base.uiBehaviour.m_sprMail.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMailClick));
			base.uiBehaviour.m_sprSet.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSetClick));
			base.uiBehaviour.m_sprXinyue.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnXinyueClick));
			base.uiBehaviour.m_sprFriend.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnFriendsClick));
			base.uiBehaviour.m_chxAutoVoice.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnAutoVoiceClick));
			base.uiBehaviour.m_Input.RegisterChangeEventHandler(new InputChangeEventHandler(this.OnUIInputChanged));
			base.uiBehaviour.m_Input.RegisterSubmitEventHandler(new InputSubmitEventHandler(this.OnUIInputSubmit));
			base.uiBehaviour.m_sprTq.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnMemberPrivilegeClick));
		}

		// Token: 0x0600ACAD RID: 44205 RVA: 0x001FD90C File Offset: 0x001FBB0C
		private void OnMemberPrivilegeClick(IXUISprite btn)
		{
			bool isFighting = this.isFighting;
			if (!isFighting)
			{
				DlgBase<XWelfareView, XWelfareBehaviour>.singleton.CheckActiveMemberPrivilege(MemberPrivilege.KingdomPrivilege_Court);
			}
		}

		// Token: 0x0600ACAE RID: 44206 RVA: 0x001FD934 File Offset: 0x001FBB34
		protected override void OnShow()
		{
			base.OnShow();
			this.SetDepth();
			this.cacheShow = true;
			this.ShowTabs();
			this.ShowBtns();
			this.ShowMailRedpoint();
			bool flag = this.activeChannelType == ChatChannelType.Friends;
			if (flag)
			{
				DlgBase<XFriendsView, XFriendsBehaviour>.singleton.QueryRoleState();
			}
			this.DoSelectChannel(this.activeChannelType);
			this.SwitchTab(this.activeChannelType);
			XSingleton<XChatIFlyMgr>.singleton.SetAutoPlayChannel(this.activeChannelType);
			this.ResetInput();
			base.uiBehaviour.m_sprXinyueRed.SetVisible(XSingleton<XGameSysMgr>.singleton.GetSysRedPointStateConsiderBlock(XSysDefine.XSys_GC_XiaoYueGuanJia));
			base.uiBehaviour.m_Flower.SetActive(false);
			bool flag2 = DlgBase<XTeamView, TabDlgBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				DlgBase<XTeamView, TabDlgBehaviour>.singleton.SetRelatedDlg(this);
			}
		}

		// Token: 0x0600ACAF RID: 44207 RVA: 0x001FDA0C File Offset: 0x001FBC0C
		protected override void OnHide()
		{
			this.ResetTabs();
			this.mInputType = InputUIType.Normal;
			this.mOnSend = null;
			XSingleton<XChatIFlyMgr>.singleton.SetAutoPlayChannel(ChatChannelType.DEFAULT);
			bool flag = DlgBase<XTeamView, TabDlgBehaviour>.singleton.IsVisible();
			if (flag)
			{
				DlgBase<XTeamView, TabDlgBehaviour>.singleton.SetRelatedDlg(null);
			}
			bool flag2 = DlgBase<ChatAssistView, ChatAssistBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				DlgBase<ChatAssistView, ChatAssistBehaviour>.singleton.SetVisible(false, true);
			}
			base.OnHide();
		}

		// Token: 0x0600ACB0 RID: 44208 RVA: 0x001FDA7B File Offset: 0x001FBC7B
		protected override void OnUnload()
		{
			this._doc = null;
			base.OnUnload();
		}

		// Token: 0x0600ACB1 RID: 44209 RVA: 0x001FDA8C File Offset: 0x001FBC8C
		public void TryCloseChat(IXUIDlg dlg)
		{
			bool flag = base.IsVisible() && dlg.fileName != this.fileName && dlg.isHideChat;
			if (flag)
			{
				DlgBase<XChatView, XChatBehaviour>.singleton.SetVisible(false, true);
			}
		}

		// Token: 0x0600ACB2 RID: 44210 RVA: 0x001FDAD4 File Offset: 0x001FBCD4
		public void TryShowChat(IXUIDlg dlg)
		{
			List<IXUIDlg> showedUI = XSingleton<UIManager>.singleton.GetShowedUI();
			bool flag = !XSingleton<UIManager>.singleton.IsUIShowed() && showedUI.Count < 3;
			if (flag)
			{
				bool flag2 = dlg.fileName != this.fileName && this.cacheShow;
				if (flag2)
				{
					this.SetVisible(true, true);
				}
			}
			bool flag3 = base.IsVisible();
			if (flag3)
			{
				this.ShowMailRedpoint();
			}
		}

		// Token: 0x0600ACB3 RID: 44211 RVA: 0x001FDB48 File Offset: 0x001FBD48
		private void DoChatWith(ulong friendId)
		{
			this.ChatFriendId = friendId;
			this.activeChannelType = ChatChannelType.Friends;
			bool flag = !base.IsVisible();
			if (flag)
			{
				this.SetVisibleWithAnimation(true, new DlgBase<XChatView, XChatBehaviour>.OnAnimationOver(this.DoChatRefresh));
			}
			else
			{
				this.DoChatRefresh();
			}
		}

		// Token: 0x0600ACB4 RID: 44212 RVA: 0x001FDB94 File Offset: 0x001FBD94
		public void DoChatRefresh()
		{
			ChatFriendData chatFriendData = this._doc.FindFriendData(this.ChatFriendId);
			bool flag = chatFriendData != null;
			if (flag)
			{
				chatFriendData.msgtime = DateTime.Now;
				this.SelectChatFriends(this.ChatFriendId);
			}
		}

		// Token: 0x0600ACB5 RID: 44213 RVA: 0x001FDBDB File Offset: 0x001FBDDB
		public void SelectChatFriends(object obj)
		{
			this.ChatFriendId = (ulong)obj;
			this.activeChannelType = ChatChannelType.Friends;
			this.SwitchTab(ChatChannelType.Friends);
			this.RefreshFriendUI(XChatView.ChatFriendState.CHATS);
		}

		// Token: 0x0600ACB6 RID: 44214 RVA: 0x001FDC06 File Offset: 0x001FBE06
		public void SelectChatTeam()
		{
			this.SwitchTab(ChatChannelType.Team);
		}

		// Token: 0x0600ACB7 RID: 44215 RVA: 0x001FDC18 File Offset: 0x001FBE18
		public void ShowMyChatVoiceInfo(ChatVoiceInfo info)
		{
			this.mChatInfo = new ChatInfo();
			bool isLocalPath = info.isLocalPath;
			if (isLocalPath)
			{
				this.mChatInfo.mChannelId = this.activeChannelType;
			}
			else
			{
				this.mChatInfo.mChannelId = info.channel + 1;
			}
			this.mChatInfo.voice = info;
			this.mChatInfo.mSenderId = info.sendIndexId;
			this.mChatInfo.mSenderName = info.sendName;
			this.mChatInfo.mChatType = ChatType.SelfVoice;
			XRechargeDocument specificDocument = XDocuments.GetSpecificDocument<XRechargeDocument>(XRechargeDocument.uuID);
			this.mChatInfo.mSenderVip = specificDocument.VipLevel;
			this.mChatInfo.mServerProfession = (uint)XSingleton<XAttributeMgr>.singleton.XPlayerData.Profession;
			this.mChatInfo.isSelfSender = true;
			this.mChatInfo.mTime = DateTime.Now;
			this.mChatInfo.isAudioPlayed = true;
			bool flag = this.mChatInfo.mChannelId == ChatChannelType.Friends;
			if (flag)
			{
				this.mChatInfo.mReceiverId = this.ChatFriendId;
				this.mChatInfo.mReceiverName = this.m_sPrivateChatCurrName;
			}
			this.mChatInfo.mContent = "";
			this._doc.ReceiveChatInfo(this.mChatInfo);
			bool flag2 = base.IsVisible();
			if (flag2)
			{
				IXUILabelSymbol ixuilabelSymbol = this.mChatInfo.mUIObject.transform.Find("voice/content").GetComponent("XUILabelSymbol") as IXUILabelSymbol;
				ixuilabelSymbol.InputText = "     ";
			}
		}

		// Token: 0x0600ACB8 RID: 44216 RVA: 0x001FDD98 File Offset: 0x001FBF98
		public bool CheckWorldSendMsg(bool isVoice, ButtonClickEventHandler okClickHandler = null, ChatChannelType channel = ChatChannelType.DEFAULT)
		{
			bool result = true;
			bool flag = okClickHandler == null;
			if (flag)
			{
				okClickHandler = new ButtonClickEventHandler(this.OKClickEventHandler);
			}
			bool flag2 = channel == ChatChannelType.DEFAULT;
			if (flag2)
			{
				channel = this.activeChannelType;
			}
			bool flag3 = channel == ChatChannelType.World;
			if (flag3)
			{
				bool flag4 = this.worldSpeakTimes > 0U;
				if (flag4)
				{
					return result;
				}
				bool flag5 = XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemCount(51) < 1UL;
				if (flag5)
				{
					string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("ChatItemCost").Split(XGlobalConfig.SequenceSeparator);
					ulong num = 1UL;
					ulong.TryParse(array[1], out num);
					int num2 = DateTime.Now.Month + DateTime.Now.Day;
					int @int = PlayerPrefs.GetInt("chat_timestamp", 0);
					this.mIsVoice = isVoice;
					bool flag6 = @int == 0 || @int != num2;
					if (flag6)
					{
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(true, true);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetSingleButtonMode(false);
						string @string = XStringDefineProxy.GetString("CHAT_BUY", new object[]
						{
							num
						});
						string string2 = XStringDefineProxy.GetString("CHAT_BUY_OK");
						string string3 = XStringDefineProxy.GetString("CHAT_BUY_CANCEL");
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.ShowNoTip(XTempTipDefine.OD_CHAT_WORLD);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetLabelsWithSymbols(@string, string2, string3);
						DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetModalCallback(okClickHandler, new ButtonClickEventHandler(this.CheckSelect));
					}
					else
					{
						okClickHandler(null);
					}
					result = false;
				}
			}
			return result;
		}

		// Token: 0x0600ACB9 RID: 44217 RVA: 0x001FDF2C File Offset: 0x001FC12C
		public bool CheckSelect(IXUIButton select)
		{
			bool tempTip = DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.GetTempTip(XTempTipDefine.OD_CHAT_WORLD);
			bool flag = tempTip;
			if (flag)
			{
				int num = DateTime.Now.Month + DateTime.Now.Day;
				PlayerPrefs.SetInt("chat_timestamp", num);
			}
			bool flag2 = DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.IsVisible();
			if (flag2)
			{
				DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.DoClose(null);
			}
			return true;
		}

		// Token: 0x0600ACBA RID: 44218 RVA: 0x001FDF98 File Offset: 0x001FC198
		private bool OKClickEventHandler(IXUIButton button)
		{
			this.CheckSelect(button);
			string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("ChatItemCost").Split(XGlobalConfig.SequenceSeparator);
			ulong num = 7UL;
			ulong num2 = 1UL;
			ulong.TryParse(array[0], out num);
			ulong.TryParse(array[1], out num2);
			bool flag = XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemCount(7) >= num2;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddLog("buy lanniao msg send", null, null, null, null, null, XDebugColor.XDebug_None);
				XPurchaseDocument specificDocument = XDocuments.GetSpecificDocument<XPurchaseDocument>(XPurchaseDocument.uuID);
				bool flag2 = this.mIsVoice;
				if (flag2)
				{
					XSingleton<XChatIFlyMgr>.singleton.ResendLastWorldChat();
				}
				else
				{
					string text = base.uiBehaviour.m_ChatText.GetText();
					this.SendChatContent(text, this.activeChannelType, true, null, false, 0UL, 0f, false, false);
					this.ResetInput();
				}
			}
			else
			{
				DlgBase<XPurchaseView, XPurchaseBehaviour>.singleton.ShowBorad((ItemEnum)num);
				this.ResetInput();
			}
			DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.DoCancel(button);
			return true;
		}

		// Token: 0x0600ACBB RID: 44219 RVA: 0x001FE0A4 File Offset: 0x001FC2A4
		public void ShowOtherChatVoiceInfo(ChatVoiceInfo info)
		{
			ChatInfo chatInfo = new ChatInfo();
			bool isLocalPath = info.isLocalPath;
			if (isLocalPath)
			{
				chatInfo.mChannelId = this.CurrentSpeakChannel;
			}
			else
			{
				chatInfo.mChannelId = info.channel;
			}
			chatInfo.voice = info;
			chatInfo.mSenderId = info.sendIndexId;
			chatInfo.mSenderName = info.sendName;
			chatInfo.mChatType = ChatType.OtherVoice;
			chatInfo.isSelfSender = false;
			chatInfo.mContent = info.txt;
			chatInfo.mTime = DateTime.Now;
			bool flag = chatInfo.mChannelId == ChatChannelType.Team;
			if (flag)
			{
				chatInfo.isAudioPlayed = true;
			}
			XFriendData friendDataById = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendDataById(chatInfo.mSenderId);
			bool flag2 = friendDataById != null;
			if (flag2)
			{
				chatInfo.mSenderVip = friendDataById.viplevel;
				chatInfo.mServerProfession = friendDataById.profession;
			}
			else
			{
				chatInfo.mSenderVip = 0U;
				uint mServerProfession = 1U;
				bool flag3 = uint.TryParse(info.sendProf, out mServerProfession);
				if (flag3)
				{
					chatInfo.mServerProfession = mServerProfession;
				}
				else
				{
					chatInfo.mServerProfession = 1U;
				}
			}
			bool flag4 = this._doc == null;
			if (flag4)
			{
				this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
			}
			bool flag5 = info.channel == ChatChannelType.Team && XSingleton<XChatIFlyMgr>.singleton.IsAutoPlayEnable;
			if (flag5)
			{
				XSingleton<XChatIFlyMgr>.singleton.AddAutoPlayList(chatInfo);
			}
			this._doc.ReceiveChatInfo(chatInfo);
		}

		// Token: 0x0600ACBC RID: 44220 RVA: 0x001FE1F0 File Offset: 0x001FC3F0
		public void PrivateChatTo(ChatFriendData data)
		{
			bool flag = this._doc == null;
			if (flag)
			{
				this._doc = this.ChatDoc;
			}
			XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
			bool flag2 = xplayerData == null || data.roleid == xplayerData.RoleID;
			if (flag2)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_NOT_SELF"), "fece00");
			}
			else
			{
				bool flag3 = XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.World;
				if (flag3)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_FORBIT_WORLD"), "fece00");
				}
				else
				{
					ChatFriendData chatFriendData = this._doc.FindFriendData(data.roleid);
					bool flag4 = chatFriendData == null;
					if (flag4)
					{
						this._doc.ChatFriendList.Add(data);
					}
					else
					{
						chatFriendData.msgtime = DateTime.Now;
					}
					this.DoChatWith(data.roleid);
				}
			}
		}

		// Token: 0x0600ACBD RID: 44221 RVA: 0x001FE2DC File Offset: 0x001FC4DC
		private bool IsContentValid(string content, ChatChannelType type)
		{
			bool flag = content == XStringDefineProxy.GetString("CHAT_DEFAULT");
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				content = content.Replace("{@", "").Replace("@}", "");
				string pattern = "[\\u4e00-\\u9fa5]";
				string text = Regex.Replace(content, pattern, "aa", RegexOptions.IgnoreCase);
				bool flag2 = this._doc == null;
				if (flag2)
				{
					this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
					this._doc.ChatView = this;
				}
				uint length = this._doc.GetRawData(type).length;
				text = text.Trim();
				bool flag3 = length != 0U && (long)text.Length > (long)((ulong)length);
				if (flag3)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_TOO_LONG"), "fece00");
					result = false;
				}
				else
				{
					bool flag4 = text.Length == 0;
					if (flag4)
					{
						XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_TOO_SHORT"), "fece00");
						result = false;
					}
					else
					{
						string pattern2 = "\\[[0-9a-fA-F]{6}\\]";
						string pattern3 = "\\[[a-fA-F\\-]{1}\\]";
						string pattern4 = "\\[[0-9a-fA-F]{2}\\]";
						bool flag5 = Regex.IsMatch(content, pattern2) || Regex.IsMatch(content, pattern3) || Regex.IsMatch(content, pattern4) || content.Contains("[color=#");
						if (flag5)
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_INVALID"), "fece00");
							result = false;
						}
						else
						{
							result = true;
						}
					}
				}
			}
			return result;
		}

		// Token: 0x0600ACBE RID: 44222 RVA: 0x001FE45C File Offset: 0x001FC65C
		public void SendVoiceChat(string content, ChatChannelType channelType, ulong audioid, float audiotime)
		{
			this.SendChatContent(content, channelType, true, null, false, audioid, audiotime, false, false);
		}

		// Token: 0x0600ACBF RID: 44223 RVA: 0x001FE47C File Offset: 0x001FC67C
		private string HandlerContent(string content)
		{
			content = content.Replace("[b]", "").Replace("[/b]", "").Replace("[\\b]", "");
			content = content.Replace("[i]", "").Replace("[/i]", "").Replace("[\\i]", "");
			content = content.Replace("[u]", "").Replace("[/u]", "").Replace("[\\u]", "");
			content = content.Replace("[s]", "").Replace("[/s]", "").Replace("[\\s]", "");
			content = content.Replace("[sub]", "").Replace("[/sub]", "").Replace("[\\sub]", "");
			content = content.Replace("[url=http", "").Replace("[/url]", "").Replace("[\\url]", "");
			bool flag = content.IndexOf("{@") != -1;
			if (flag)
			{
				string pattern = "\\{\\@[0-9]*[A-Za-z0-9_\\u4e00-\\u9fa5]*\\@\\}";
				MatchCollection matchCollection = Regex.Matches(content, pattern, RegexOptions.IgnoreCase);
				bool flag2 = matchCollection != null;
				if (flag2)
				{
					bool flag3 = matchCollection.Count > 0;
					if (flag3)
					{
						content += "e@equip";
					}
					for (int i = 0; i < matchCollection.Count; i++)
					{
						string value = matchCollection[i].Value;
						string text = value.Replace("{@", "").Replace("@}", "");
						int num = -1;
						int.TryParse(text.Split(new char[]
						{
							'_'
						})[0], out num);
						bool flag4 = num <= 0 || num - 1 >= this.chatContentItem.Count;
						if (flag4)
						{
							content = content.Replace(value, text.Replace(num + "_", ""));
						}
						else
						{
							string text2 = this.chatContentItem[num - 1];
							text2 = text2.Replace(";", "");
							int num2 = -1;
							int.TryParse(text2.Split(new char[]
							{
								'_'
							})[5], out num2);
							bool flag5 = num2 <= 0;
							if (flag5)
							{
								content = content.Replace(value, text.Replace(num + "_", ""));
							}
							else
							{
								bool flag6 = num != num2;
								if (flag6)
								{
									content = content.Replace(value, text.Replace(num + "_", ""));
								}
								else
								{
									string str = text2.Split(new char[]
									{
										'_'
									})[4];
									content = content.Replace(value, "{@" + str + "@}");
									content += this.chatContentItem[num - 1];
								}
							}
						}
					}
				}
			}
			bool flag7 = content.IndexOf("\\\\") == 0;
			if (flag7)
			{
				bool flag8 = content.IndexOf("\\\\n") == 0;
				if (flag8)
				{
					string str2 = content.Substring(0, 3);
					string str3 = content.Substring(3, content.Length - 3).Replace("\\\\n", "//n").Replace("\\", "/");
					content = str2 + str3;
				}
				else
				{
					string str4 = content.Substring(0, 2);
					string str5 = content.Substring(2, content.Length - 2).Replace("\\\\n", "//n").Replace("\\", "/");
					content = str4 + str5;
				}
			}
			else
			{
				content = content.Replace("\\n", "/n").Replace("\\", "/");
			}
			return XSingleton<XForbidWordMgr>.singleton.FilterForbidWord(content);
		}

		// Token: 0x0600ACC0 RID: 44224 RVA: 0x001FE8B0 File Offset: 0x001FCAB0
		public void SendChatContent(string content, ChatChannelType channelType, bool selfReceive = true, List<ChatParam> param = null, bool bIsSystem = false, ulong audioid = 0UL, float audiotime = 0f, bool isRecruit = false, bool isDragonGuildRecruit = false)
		{
			XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
			bool flag = !this.IsContentValid(content, channelType) || xplayerData == null;
			if (!flag)
			{
				bool flag2 = channelType == ChatChannelType.Friends && DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsBlock(this.ChatFriendId);
				if (flag2)
				{
					XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_BLOCK_2"), "fece00");
				}
				else
				{
					content = this.HandlerContent(content);
					RpcC2M_chat rpcC2M_chat = new RpcC2M_chat();
					rpcC2M_chat.oArg.chatinfo = new KKSG.ChatInfo();
					rpcC2M_chat.oArg.chatinfo.channel = (uint)channelType;
					bool flag3 = channelType == ChatChannelType.Friends;
					if (flag3)
					{
						rpcC2M_chat.oArg.chatinfo.dest = new ChatDest();
						rpcC2M_chat.oArg.chatinfo.dest.roleid.Add(this.ChatFriendId);
						ChatInfo chatInfo = new ChatInfo();
						chatInfo.mSenderName = xplayerData.Name;
						chatInfo.mSenderId = xplayerData.RoleID;
						chatInfo.mReceiverId = this.ChatFriendId;
						chatInfo.mReceiverName = ((this.UIOP.CurrChatFriendData == null) ? "" : this.UIOP.CurrChatFriendData.name);
						chatInfo.mReceiverVip = ((this.UIOP.CurrChatFriendData == null) ? 1U : this.UIOP.CurrChatFriendData.viplevel);
						chatInfo.mRecieverProfession = ((this.UIOP.CurrChatFriendData == null) ? 1U : this.UIOP.CurrChatFriendData.profession);
						chatInfo.mReciverPowerPoint = ((this.UIOP.CurrChatFriendData == null) ? 0U : this.UIOP.CurrChatFriendData.powerpoint);
						chatInfo.mContent = content;
						chatInfo.mChannelId = ChatChannelType.Friends;
						chatInfo.mChatType = ChatType.SelfText;
						chatInfo.isSelfSender = true;
						chatInfo.mAudioId = audioid;
						chatInfo.mAudioTime = (uint)audiotime;
						bool flag4 = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsBlock(this.ChatFriendId);
						if (flag4)
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetBlockFriendNameById(this.ChatFriendId) + XStringDefineProxy.GetString("CHAT_BAN_LIST"), "fece00");
							return;
						}
					}
					bool flag5 = channelType == ChatChannelType.Group;
					if (flag5)
					{
						rpcC2M_chat.oArg.chatinfo.groupchatinfo = new GroupChatTeamInfo();
						rpcC2M_chat.oArg.chatinfo.groupchatinfo.groupchatID = DlgBase<XChatView, XChatBehaviour>.singleton.ChatGroupId;
					}
					rpcC2M_chat.oArg.chatinfo.info = content;
					bool flag6 = param != null;
					if (flag6)
					{
						for (int i = 0; i < param.Count; i++)
						{
							rpcC2M_chat.oArg.chatinfo.param.Add(param[i]);
						}
					}
					rpcC2M_chat.oArg.chatinfo.param.Add(new ChatParam());
					rpcC2M_chat.oArg.chatinfo.issystem = bIsSystem;
					rpcC2M_chat.oArg.chatinfo.isRecruit = isRecruit;
					rpcC2M_chat.oArg.chatinfo.audioUid = audioid;
					rpcC2M_chat.oArg.chatinfo.audioLen = ((audiotime >= 1000f) ? ((uint)audiotime) : 1000U);
					rpcC2M_chat.oArg.chatinfo.isDragonGuildRecruit = isDragonGuildRecruit;
					XSingleton<XClientNetwork>.singleton.Send(rpcC2M_chat);
				}
			}
		}

		// Token: 0x0600ACC1 RID: 44225 RVA: 0x001FEC18 File Offset: 0x001FCE18
		public void SendExternalFriendChat(string content, ChatInfo recvInfo, ulong audioid = 0UL, float audiotime = 0f, List<ChatParam> param = null)
		{
			bool flag = DlgBase<XFriendsView, XFriendsBehaviour>.singleton.IsBlock(recvInfo.mReceiverId);
			if (flag)
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_BLOCK_2"), "fece00");
			}
			else
			{
				this.HandlerContent(content);
				RpcC2M_chat rpcC2M_chat = new RpcC2M_chat();
				rpcC2M_chat.oArg.chatinfo = new KKSG.ChatInfo();
				rpcC2M_chat.oArg.chatinfo.channel = 3U;
				rpcC2M_chat.oArg.chatinfo.dest = new ChatDest();
				rpcC2M_chat.oArg.chatinfo.dest.roleid.Add(recvInfo.mReceiverId);
				ChatInfo chatInfo = new ChatInfo();
				chatInfo.mSenderName = XSingleton<XAttributeMgr>.singleton.XPlayerData.Name;
				chatInfo.mSenderId = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
				chatInfo.mReceiverId = recvInfo.mReceiverId;
				chatInfo.mReceiverName = recvInfo.mReceiverName;
				chatInfo.mReceiverVip = recvInfo.mReceiverVip;
				chatInfo.mRecieverProfession = recvInfo.mRecieverProfession;
				chatInfo.mReciverPowerPoint = recvInfo.mReciverPowerPoint;
				chatInfo.mContent = content;
				chatInfo.mChannelId = ChatChannelType.Friends;
				chatInfo.mChatType = ChatType.SelfText;
				chatInfo.isSelfSender = true;
				chatInfo.mAudioId = audioid;
				chatInfo.mAudioTime = (uint)audiotime;
				this.ProcessText(chatInfo, param);
				bool flag2 = this._doc != null;
				if (flag2)
				{
					this._doc.ReceiveChatInfo(chatInfo);
				}
				rpcC2M_chat.oArg.chatinfo.info = content;
				bool flag3 = param != null;
				if (flag3)
				{
					for (int i = 0; i < param.Count; i++)
					{
						rpcC2M_chat.oArg.chatinfo.param.Add(param[i]);
					}
				}
				rpcC2M_chat.oArg.chatinfo.param.Add(new ChatParam());
				rpcC2M_chat.oArg.chatinfo.issystem = false;
				rpcC2M_chat.oArg.chatinfo.isRecruit = false;
				rpcC2M_chat.oArg.chatinfo.audioUid = audioid;
				rpcC2M_chat.oArg.chatinfo.audioLen = ((audiotime >= 1000f) ? ((uint)audiotime) : 1000U);
				XSingleton<XClientNetwork>.singleton.Send(rpcC2M_chat);
			}
		}

		// Token: 0x0600ACC2 RID: 44226 RVA: 0x001FEE5C File Offset: 0x001FD05C
		private void ProcessText(ChatInfo chatInfo, List<ChatParam> chatParam = null)
		{
			bool flag = chatParam == null;
			if (!flag)
			{
				for (int i = 0; i < chatParam.Count; i++)
				{
					ChatParam chatParam2 = chatParam[i];
					bool flag2 = chatParam2 == null;
					if (!flag2)
					{
						for (int j = 0; j < chatInfo.mContent.Length; j++)
						{
							bool flag3 = chatInfo.mContent[j] == '$';
							if (flag3)
							{
								string str = "";
								bool flag4 = chatParam2.link != null && chatInfo.mContent[j + 1] == 'L';
								if (flag4)
								{
									XInvitationDocument specificDocument = XDocuments.GetSpecificDocument<XInvitationDocument>(XInvitationDocument.uuID);
									str = specificDocument.ParseLink(chatParam2);
								}
								string str2 = chatInfo.mContent.Substring(0, j);
								string str3 = chatInfo.mContent.Substring(j + 2, chatInfo.mContent.Length - (j + 2));
								chatInfo.mContent = str2 + str + str3;
								break;
							}
						}
					}
				}
			}
		}

		// Token: 0x0600ACC3 RID: 44227 RVA: 0x001FEF78 File Offset: 0x001FD178
		public void AddChat(string content, ChatChannelType type, List<ChatParam> param = null, bool bIsSystem = false)
		{
			this.SendChatContent(content, type, true, param, bIsSystem, 0UL, 0f, false, false);
		}

		// Token: 0x0600ACC4 RID: 44228 RVA: 0x001FEF9C File Offset: 0x001FD19C
		public void SetActiveChannel(ChatChannelType type)
		{
			this.activeChannelType = type;
			bool flag = base.IsVisible();
			if (flag)
			{
				this.SwitchTab(type);
			}
		}

		// Token: 0x0600ACC5 RID: 44229 RVA: 0x001FEFC8 File Offset: 0x001FD1C8
		public void ShowChannel(ChatChannelType type)
		{
			this.SetVisibleWithAnimation(true, null);
			XSingleton<XTimerMgr>.singleton.SetTimer(0.5f, new XTimerMgr.ElapsedEventHandler(this.SwitchTab), type);
		}

		// Token: 0x0600ACC6 RID: 44230 RVA: 0x001FEFF8 File Offset: 0x001FD1F8
		public void SwitchTab(object obj)
		{
			int num = (int)obj;
			for (int i = 0; i < 11; i++)
			{
				bool flag = num == (int)this.showChannelIds[i];
				if (flag)
				{
					this.mCheckbox[i].bChecked = true;
				}
			}
		}

		// Token: 0x0600ACC7 RID: 44231 RVA: 0x001FF040 File Offset: 0x001FD240
		public void RefeshWorldSpeakTimes()
		{
			bool flag = base.uiBehaviour != null && base.uiBehaviour.m_lblWorldTimes != null;
			if (flag)
			{
				base.uiBehaviour.m_lblWorldTimes.SetVisible(this.worldSpeakTimes > 0U);
				bool flag2 = this.worldSpeakTimes > 0U && this.activeChannelType == ChatChannelType.World;
				if (flag2)
				{
					base.uiBehaviour.m_worldTween.ResetTween(true);
					base.uiBehaviour.m_worldTween.PlayTween(true, -1f);
				}
				XWelfareDocument specificDocument = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
				bool flag3 = specificDocument.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Court);
				PayMemberPrivilege payMemberPrivilege = specificDocument.PayMemberPrivilege;
				bool flag4 = flag3 && payMemberPrivilege != null && payMemberPrivilege.usedChatCount < specificDocument.GetMemberPrivilegeConfig(MemberPrivilege.KingdomPrivilege_Court).ChatCount;
				if (flag4)
				{
					base.uiBehaviour.m_lblWorldTimes.SetText(XStringDefineProxy.GetString("CHAT_WORLD2", new object[]
					{
						"[ffff00]" + this.worldSpeakTimes + "[-]"
					}));
				}
				else
				{
					base.uiBehaviour.m_lblWorldTimes.SetText(XStringDefineProxy.GetString("CHAT_WORLD2", new object[]
					{
						this.worldSpeakTimes
					}));
				}
			}
			bool flag5 = base.uiBehaviour != null && base.uiBehaviour.m_ChatTextCost != null;
			if (flag5)
			{
				base.uiBehaviour.m_ChatTextCost.SetText((this.worldSpeakTimes > 0U) ? XStringDefineProxy.GetString("DRAW_FREE") : XStringDefineProxy.GetString("DRAW_BIRD"));
			}
		}

		// Token: 0x0600ACC8 RID: 44232 RVA: 0x001FF1D8 File Offset: 0x001FD3D8
		public void DoSelectChannel(ChatChannelType type)
		{
			this.activeChannelType = type;
			this.ShowTabFriendRed();
			this.RefeshWorldSpeakTimes();
			base.uiBehaviour.m_objFriendBar.SetActive(type == ChatChannelType.Friends);
			base.uiBehaviour.m_objGroupBar.SetActive(type == ChatChannelType.Group);
			base.uiBehaviour.m_lblWorldTimes.SetVisible(type == ChatChannelType.World && this.worldSpeakTimes > 0U);
			XWelfareDocument specificDocument = XDocuments.GetSpecificDocument<XWelfareDocument>(XWelfareDocument.uuID);
			bool flag = specificDocument.IsOwnMemberPrivilege(MemberPrivilege.KingdomPrivilege_Court);
			base.uiBehaviour.m_sprTq.gameObject.SetActive(type == ChatChannelType.World && this.worldSpeakTimes > 0U);
			base.uiBehaviour.m_sprTq.SetSprite(specificDocument.GetMemberPrivilegeIcon(MemberPrivilege.KingdomPrivilege_Court));
			int chatCount = specificDocument.GetMemberPrivilegeConfig(MemberPrivilege.KingdomPrivilege_Court).ChatCount;
			base.uiBehaviour.m_lblPriviledge.SetText(XStringDefineProxy.GetString("CHAT_PRIVILEDGE", new object[]
			{
				chatCount
			}));
			base.uiBehaviour.m_sprTq.SetGrey(flag);
			base.uiBehaviour.m_lblPriviledge.SetEnabled(flag);
			base.uiBehaviour.m_sprFriend.SetAlpha((float)((XSingleton<XGame>.singleton.CurrentStage.Stage == EXStage.Hall) ? 1 : 0));
			this.RefreshVoiceBarStatus();
			this.ShowTextboard(type);
			this.m_uiBehaviour.m_ChatTextCost.SetVisible(type == ChatChannelType.World);
			this.SetLoopActive(type);
			bool flag2 = type == ChatChannelType.Friends;
			if (flag2)
			{
				this.RefreshFriendUI(this.friendState);
			}
			else
			{
				bool flag3 = type == ChatChannelType.Group;
				if (flag3)
				{
					this.groupState = XChatView.ChatGroupState.GROUPS;
					this.RefreshGrouplist();
				}
				else
				{
					this.RefreshLoopScroll(type);
				}
			}
			XSingleton<XChatIFlyMgr>.singleton.SetAutoPlayChannel(type);
		}

		// Token: 0x0600ACC9 RID: 44233 RVA: 0x001FF390 File Offset: 0x001FD590
		private void RefreshVoiceBarStatus()
		{
			bool flag = base.IsVisible();
			if (flag)
			{
				base.uiBehaviour.m_btns.SetActive(this.IsVoicebarShow());
				base.uiBehaviour.m_lblAutoVoice.SetText(XStringDefineProxy.GetString("CHAT_AutoPlay", new object[]
				{
					this.ChatDoc.GetRawData(this.activeChannelType).name
				}));
				base.uiBehaviour.m_chxAutoVoice.bChecked = this.GetAutoVoiceSetting(this.activeChannelType);
			}
		}

		// Token: 0x0600ACCA RID: 44234 RVA: 0x001FF418 File Offset: 0x001FD618
		private bool IsVoicebarShow()
		{
			bool result = false;
			int i = 0;
			int num = this.showVoiceBar.Length;
			while (i < num)
			{
				bool flag = this.activeChannelType == this.showVoiceBar[i];
				if (flag)
				{
					result = true;
					break;
				}
				i++;
			}
			return result;
		}

		// Token: 0x0600ACCB RID: 44235 RVA: 0x001FF468 File Offset: 0x001FD668
		private bool GetAutoVoiceSetting(ChatChannelType type)
		{
			XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
			return Convert.ToBoolean(specificDocument.GetValue(this.Channel2OptionDef(type)));
		}

		// Token: 0x0600ACCC RID: 44236 RVA: 0x001FF498 File Offset: 0x001FD698
		private void SetAutoVoice(ChatChannelType type, bool val)
		{
			XOptionsDocument specificDocument = XDocuments.GetSpecificDocument<XOptionsDocument>(XOptionsDocument.uuID);
			specificDocument.SetValue(this.Channel2OptionDef(type), val ? 1 : 0, false);
			specificDocument.SaveSetting();
		}

		// Token: 0x0600ACCD RID: 44237 RVA: 0x001FF4D0 File Offset: 0x001FD6D0
		private XOptionsDefine Channel2OptionDef(ChatChannelType type)
		{
			switch (type)
			{
			case ChatChannelType.ZeroChannel:
				return XOptionsDefine.OD_RADIO_WIFI;
			case ChatChannelType.World:
				return XOptionsDefine.OD_RADIO_WORLD;
			case ChatChannelType.Guild:
				return XOptionsDefine.OD_RADIO_PUBLIC;
			case ChatChannelType.Friends:
				return XOptionsDefine.OD_RADIO_PRIVATE;
			case ChatChannelType.Team:
				return XOptionsDefine.OD_RADIO_TEAM;
			case ChatChannelType.Camp:
				return XOptionsDefine.OD_RADIO_CAMP;
			case ChatChannelType.Curr:
				return XOptionsDefine.OD_RADIO_AUTO_PALY;
			}
			return XOptionsDefine.OD_RADIO_WORLD;
		}

		// Token: 0x0600ACCE RID: 44238 RVA: 0x001FF540 File Offset: 0x001FD740
		private string GetPlayerNameById(ulong uid)
		{
			return DlgBase<XFriendsView, XFriendsBehaviour>.singleton.GetFriendNameById(uid);
		}

		// Token: 0x0600ACCF RID: 44239 RVA: 0x001FF560 File Offset: 0x001FD760
		public void OnRefreshGetFlowerInfo()
		{
			bool flag = !base.IsVisible();
			if (!flag)
			{
				base.uiBehaviour.m_GetFlowerLeftTime.gameObject.SetActive(this._doc.getFlowerLeftTime > 0);
				base.uiBehaviour.m_GetFlowerBtn.SetEnable(this._doc.getFlowerLeftTime == 0, false);
				base.uiBehaviour.m_FlowerEff.SetActive(this._doc.getFlowerLeftTime == 0 && this._doc.canGetFlower);
				bool flag2 = !this._doc.canGetFlower;
				if (flag2)
				{
					base.uiBehaviour.m_GetFlowerBtn.SetGrey(this._doc.canGetFlower);
				}
				bool flag3 = this._doc.getFlowerLeftTime == 0 && this._doc.canGetFlower;
				if (flag3)
				{
					base.uiBehaviour.m_FlowerTween.PlayTween(true, -1f);
				}
				else
				{
					base.uiBehaviour.m_FlowerTween.StopTween();
				}
				bool flag4 = this._doc.getFlowerLeftTime > 0;
				if (flag4)
				{
					base.uiBehaviour.m_GetFlowerLeftTime.SetText(string.Format("{0}", XSingleton<UiUtility>.singleton.TimeFormatString(this._doc.getFlowerLeftTime, 2, 3, 4, false, true)));
					XSingleton<XTimerMgr>.singleton.KillTimer(this._GetFlowerCDToken);
					this._GetFlowerCDToken = XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.GetFlowerCDUpdate), null);
				}
				this.UpdateFlowerCount();
			}
		}

		// Token: 0x0600ACD0 RID: 44240 RVA: 0x001FF6EC File Offset: 0x001FD8EC
		private void GetFlowerCDUpdate(object o)
		{
			this._doc.getFlowerLeftTime = (int)XSingleton<XGameSysMgr>.singleton.GetFlowerRemainTime;
			this.OnRefreshGetFlowerInfo();
		}

		// Token: 0x0600ACD1 RID: 44241 RVA: 0x001FF70C File Offset: 0x001FD90C
		private bool OnGetFlower(IXUIButton go)
		{
			bool canGetFlower = this._doc.canGetFlower;
			if (canGetFlower)
			{
				this._doc.ReqGetFlower();
			}
			else
			{
				XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("FLOWER_CHATDLG_MAX_TIMES_ERR"), "fece00");
			}
			return true;
		}

		// Token: 0x0600ACD2 RID: 44242 RVA: 0x001FF75C File Offset: 0x001FD95C
		private void UpdateFlowerCount()
		{
			string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GetFlowerTime").Split(XGlobalConfig.SequenceSeparator);
			int itemid = int.Parse(array[0]);
			base.uiBehaviour.m_FlowerOwnCount.SetText(string.Format(XStringDefineProxy.GetString("FLOWER_CHATDLG_OWN_COUNT"), XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemCount(itemid).ToString()));
		}

		// Token: 0x0600ACD3 RID: 44243 RVA: 0x001FF7CC File Offset: 0x001FD9CC
		public bool OnCloseClicked(IXUIButton sp)
		{
			this.cacheShow = false;
			this.SetVisibleWithAnimation(false, null);
			DlgBase<XFriendsView, XFriendsBehaviour>.singleton.RefreshUI();
			return true;
		}

		// Token: 0x0600ACD4 RID: 44244 RVA: 0x001FF7FC File Offset: 0x001FD9FC
		private bool OnBtmAddClick(IXUIButton btn)
		{
			DlgBase<ChatAssistView, ChatAssistBehaviour>.singleton.Show(new ChatInputStringBack(this.OnAddSelect), ChatAssetType.EMOTION);
			return true;
		}

		// Token: 0x0600ACD5 RID: 44245 RVA: 0x001FF828 File Offset: 0x001FDA28
		private void OnSetClick(IXUISprite spr)
		{
			bool flag = !XSingleton<XSceneMgr>.singleton.IsPVPScene() && !XSingleton<XSceneMgr>.singleton.IsPVEScene();
			if (flag)
			{
				DlgBase<XOptionsView, XOptionsBehaviour>.singleton.prefabTab = OptionsTab.VoiceTab;
				DlgBase<XOptionsView, XOptionsBehaviour>.singleton.SetVisibleWithAnimation(true, null);
			}
		}

		// Token: 0x0600ACD6 RID: 44246 RVA: 0x001FF870 File Offset: 0x001FDA70
		public void OnMailClick(IXUISprite sp)
		{
			DlgBase<MailSystemDlg, TabDlgBehaviour>.singleton.ShowWorkGameSystem(XSysDefine.XSys_Mail_System);
		}

		// Token: 0x0600ACD7 RID: 44247 RVA: 0x001FF884 File Offset: 0x001FDA84
		private void OnXinyueClick(IXUISprite spr)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>();
			XSingleton<UiUtility>.singleton.CloseSysAndNoticeServer((uint)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_GC_XiaoYueGuanJia));
			base.uiBehaviour.m_sprXinyueRed.SetVisible(false);
			string text = (Application.platform == (RuntimePlatform)11) ? "1" : "0";
			string text2 = string.Format("{0}?game_id={1}&opencode={2}&sig={3}&timestamp={4}&role_id={5}&partition_id={6}&plat_id={7}", new object[]
			{
				XSingleton<XGlobalConfig>.singleton.GetValue("XiaoYueUrl"),
				XSingleton<XGlobalConfig>.singleton.GetValue("XiaoYueGameID"),
				XSingleton<XClientNetwork>.singleton.OpenCode,
				XSingleton<XUpdater.XUpdater>.singleton.XPlatform.GetMD5(string.Format("{0}{1}", XSingleton<XClientNetwork>.singleton.MSDKKey, XSingleton<UiUtility>.singleton.GetTimeStamp())),
				XSingleton<UiUtility>.singleton.GetTimeStamp(),
				XSingleton<UiUtility>.singleton.GetRoleId(),
				XSingleton<XClientNetwork>.singleton.ServerID,
				text
			});
			XSingleton<XDebug>.singleton.AddLog("url = " + text2, null, null, null, null, null, XDebugColor.XDebug_None);
			dictionary["url"] = text2;
			dictionary["screendir"] = "SENSOR";
			XSingleton<XUpdater.XUpdater>.singleton.XPlatform.SendExtDara("open_url", Json.Serialize(dictionary));
		}

		// Token: 0x0600ACD8 RID: 44248 RVA: 0x001FF9D6 File Offset: 0x001FDBD6
		private void OnFriendsClick(IXUISprite spr)
		{
			DlgBase<XFriendsView, XFriendsBehaviour>.singleton.SetVisible(true, true);
		}

		// Token: 0x0600ACD9 RID: 44249 RVA: 0x001FF9E8 File Offset: 0x001FDBE8
		private bool OnAutoVoiceClick(IXUICheckBox box)
		{
			this.SetAutoVoice(this.activeChannelType, box.bChecked);
			return true;
		}

		// Token: 0x0600ACDA RID: 44250 RVA: 0x001FFA10 File Offset: 0x001FDC10
		private void OnAddSelect(string motionstr)
		{
			string text = base.uiBehaviour.m_ChatInput.GetText();
			string text2 = text + motionstr;
			base.uiBehaviour.m_ChatInput.SetText(text2);
			bool flag = base.uiBehaviour.m_ChatInput.GetText().Length - text.Length < motionstr.Length;
			if (flag)
			{
				base.uiBehaviour.m_ChatInput.SetText(text);
			}
		}

		// Token: 0x0600ACDB RID: 44251 RVA: 0x001FFA88 File Offset: 0x001FDC88
		public bool DoSendTextChat(IXUIButton sp)
		{
			bool flag = this.mInputType == InputUIType.Normal;
			if (flag)
			{
				bool flag2 = this.activeChannelType == ChatChannelType.Guild;
				if (flag2)
				{
					bool flag3 = !this.CheckGuildOpen();
					if (flag3)
					{
						XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_NOT_IN_GUILD"), "fece00");
						this.ResetInput();
						return false;
					}
				}
				else
				{
					bool flag4 = this.activeChannelType == ChatChannelType.Partner;
					if (flag4)
					{
						bool flag5 = !this.CheckDragonGuildOpen();
						if (flag5)
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("ERR_DG_NOT_IN_GUILD"), "fece00");
							this.ResetInput();
							return false;
						}
					}
					else
					{
						bool flag6 = this.activeChannelType == ChatChannelType.Team;
						if (flag6)
						{
							bool flag7 = !this.CheckTeamOpen();
							if (flag7)
							{
								XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_NOT_IN_TEAM"), "fece00");
								this.ResetInput();
								return false;
							}
						}
						else
						{
							bool flag8 = this.activeChannelType == ChatChannelType.World;
							if (flag8)
							{
								bool flag9 = !this.CheckWorldSendMsg(false, null, ChatChannelType.DEFAULT);
								if (flag9)
								{
									return false;
								}
							}
							else
							{
								bool flag10 = this.activeChannelType == ChatChannelType.Friends;
								if (flag10)
								{
									bool flag11 = this.ChatFriendId == 0UL;
									if (flag11)
									{
										XSingleton<UiUtility>.singleton.ShowSystemTip(XStringDefineProxy.GetString("CHAT_NOT_HAVE_FRIEND"), "fece00");
										this.ResetInput();
										return false;
									}
								}
							}
						}
					}
				}
				string text = base.uiBehaviour.m_ChatText.GetText();
				bool flag12 = !XSingleton<UiUtility>.singleton.IsSystemExpress(text);
				if (flag12)
				{
					this.SendChatContent(text, this.activeChannelType, true, null, false, 0UL, 0f, false, false);
				}
				this.ResetInput();
			}
			else
			{
				bool flag13 = this.mInputType == InputUIType.Linked;
				if (flag13)
				{
					this.DispatchLinkClick();
				}
			}
			return true;
		}

		// Token: 0x0600ACDC RID: 44252 RVA: 0x001FFC70 File Offset: 0x001FDE70
		private void ResetInput()
		{
			bool flag = base.IsVisible();
			if (flag)
			{
				base.uiBehaviour.m_ChatText.SetText("");
				base.uiBehaviour.m_Input.SetText("");
				base.uiBehaviour.m_Input.SetDefault(XStringDefineProxy.GetString("CHAT_DEFAULT"));
			}
		}

		// Token: 0x0600ACDD RID: 44253 RVA: 0x001FFCD1 File Offset: 0x001FDED1
		public void OnVoiceButtonDrag(IXUIButton sp, Vector2 delta)
		{
			this.m_DragDistance += delta;
			this.m_CancelRecord = (this.m_DragDistance.magnitude >= 100f);
		}

		// Token: 0x0600ACDE RID: 44254 RVA: 0x001FFD04 File Offset: 0x001FDF04
		public void OnVoiceChatButton(IXUIButton sp, bool state)
		{
			if (state)
			{
				this.m_CancelRecord = false;
				this.m_DragDistance = Vector2.zero;
				this.m_uiBehaviour.m_SpeakEff.SetActive(true);
				this.StartRecord();
			}
			else
			{
				this.m_uiBehaviour.m_SpeakEff.SetActive(false);
				bool useApollo = XChatDocument.UseApollo;
				if (useApollo)
				{
					XSingleton<XChatApolloMgr>.singleton.StopRecord(this.m_CancelRecord);
				}
				else
				{
					XSingleton<XChatIFlyMgr>.singleton.StopRecord(this.m_CancelRecord);
				}
				this.m_CancelRecord = false;
			}
		}

		// Token: 0x0600ACDF RID: 44255 RVA: 0x001FFD90 File Offset: 0x001FDF90
		private void StartRecord()
		{
			bool useApollo = XChatDocument.UseApollo;
			if (useApollo)
			{
				XSingleton<XChatApolloMgr>.singleton.StartRecord(VoiceUsage.CHAT, new EndRecordCallBack(this.AutoQuitRecord));
			}
			else
			{
				XSingleton<XChatIFlyMgr>.singleton.StartRecord(VoiceUsage.CHAT, new EndRecordCallBack(this.AutoQuitRecord));
			}
		}

		// Token: 0x0600ACE0 RID: 44256 RVA: 0x000FEEFC File Offset: 0x000FD0FC
		private void AutoQuitRecord()
		{
		}

		// Token: 0x0600ACE1 RID: 44257 RVA: 0x001FFDDC File Offset: 0x001FDFDC
		private bool SelectChatChannel(IXUICheckBox iXUICheckBox)
		{
			ChatChannelType type = (ChatChannelType)iXUICheckBox.ID;
			bool bChecked = iXUICheckBox.bChecked;
			if (bChecked)
			{
				this.DoSelectChannel(type);
			}
			return true;
		}

		// Token: 0x0600ACE2 RID: 44258 RVA: 0x001FBC7D File Offset: 0x001F9E7D
		public void OnAddFriend(IXUILabel sp)
		{
			DlgBase<XFriendsView, XFriendsBehaviour>.singleton.AddFriendById(this.ChatFriendId);
		}

		// Token: 0x0600ACE3 RID: 44259 RVA: 0x001FFE0C File Offset: 0x001FE00C
		private void OnStopAudioRecord(ChatInfo chatinfo)
		{
			bool flag = this._doc == null;
			if (flag)
			{
				this._doc = XDocuments.GetSpecificDocument<XChatDocument>(XChatDocument.uuID);
				this._doc.ChatView = this;
			}
			ChatVoiceInfo voice = chatinfo.voice;
			bool flag2 = voice != null;
			if (flag2)
			{
				ChatChannelType chatChannelType = this.activeChannelType;
				voice.channel = chatChannelType;
				bool flag3 = chatChannelType == ChatChannelType.Friends;
				if (flag3)
				{
					ulong roleID = XSingleton<XAttributeMgr>.singleton.XPlayerData.RoleID;
					this.PrivateChatCurrName = this.GetPlayerNameById(this.ChatFriendId) + "_" + this.ChatFriendId.ToString();
				}
				else
				{
					DateTime now = DateTime.Now;
					uint num = 0U;
					bool flag4 = chatChannelType == ChatChannelType.World;
					if (flag4)
					{
						num = 60U;
					}
					int num2 = chatChannelType - ChatChannelType.World;
					bool flag5 = (now - this.m_lastChatTime[num2]).TotalSeconds <= num;
					if (!flag5)
					{
						this.m_lastChatTime[chatChannelType - ChatChannelType.World] = DateTime.Now;
					}
					this.ShowMyChatVoiceInfo(voice);
				}
				this.OnStartVoiceCD();
			}
		}

		// Token: 0x0600ACE4 RID: 44260 RVA: 0x001FFF20 File Offset: 0x001FE120
		private void OnRefreshChatTextRecognize(ChatInfo info)
		{
			bool flag = this._doc != null;
			if (flag)
			{
				this._doc.OnReceiveChatSmallInfo(info);
			}
		}

		// Token: 0x0600ACE5 RID: 44261 RVA: 0x000FEEFC File Offset: 0x000FD0FC
		public void OnStartVoiceCD()
		{
		}

		// Token: 0x040040EA RID: 16618
		private XChatView.ChatGroupState _groupState = XChatView.ChatGroupState.GROUPS;

		// Token: 0x040040EB RID: 16619
		private XChatView.ChatFriendState _friendState = XChatView.ChatFriendState.FRIENDS;

		// Token: 0x040040EC RID: 16620
		private ChatChannelType cacheChannelType = ChatChannelType.World;

		// Token: 0x040040ED RID: 16621
		private List<LoopItemData> cacheLoopList = new List<LoopItemData>();

		// Token: 0x040040EE RID: 16622
		private Action mOnSend;

		// Token: 0x040040EF RID: 16623
		private InputUIType mInputType;

		// Token: 0x040040F0 RID: 16624
		private string mLinkContent;

		// Token: 0x040040F1 RID: 16625
		private Transform[] mTransTab = new Transform[11];

		// Token: 0x040040F2 RID: 16626
		private IXUICheckBox[] mCheckbox = new IXUICheckBox[11];

		// Token: 0x040040F3 RID: 16627
		private XChatDocument _doc = null;

		// Token: 0x040040F4 RID: 16628
		private ChatChannelType currentSpeakChannel = ChatChannelType.World;

		// Token: 0x040040F5 RID: 16629
		private SetEffectInfo m_iSetEffectInfo = null;

		// Token: 0x040040F6 RID: 16630
		private const int CHAT_CHANNEL_NUM = 11;

		// Token: 0x040040F7 RID: 16631
		private bool Inited = false;

		// Token: 0x040040F8 RID: 16632
		private int m_ChatIdIndex = 1;

		// Token: 0x040040F9 RID: 16633
		private XChatUIOP m_UIOP = XSingleton<XChatUIOP>.singleton;

		// Token: 0x040040FA RID: 16634
		public static bool m_YunvaInited = false;

		// Token: 0x040040FB RID: 16635
		private bool m_CancelRecord = false;

		// Token: 0x040040FC RID: 16636
		private Vector2 m_DragDistance = Vector2.zero;

		// Token: 0x040040FD RID: 16637
		private uint _GetFlowerCDToken;

		// Token: 0x040040FE RID: 16638
		private DateTime[] m_lastChatTime = new DateTime[15];

		// Token: 0x040040FF RID: 16639
		public List<string> chatContentItem = new List<string>();

		// Token: 0x04004100 RID: 16640
		public ulong ChatFriendId = 0UL;

		// Token: 0x04004101 RID: 16641
		public ulong ChatGroupId = 0UL;

		// Token: 0x04004102 RID: 16642
		private string m_sPrivateChatCurrName = "";

		// Token: 0x04004103 RID: 16643
		public bool cacheShow = false;

		// Token: 0x04004104 RID: 16644
		public uint _worldSpeadTimes;

		// Token: 0x04004105 RID: 16645
		public ChatChannelType activeChannelType = ChatChannelType.World;

		// Token: 0x04004106 RID: 16646
		private ChatChannelType[] showChannelIds = new ChatChannelType[]
		{
			ChatChannelType.World,
			ChatChannelType.Guild,
			ChatChannelType.Friends,
			ChatChannelType.Curr,
			ChatChannelType.Team,
			ChatChannelType.Partner,
			ChatChannelType.Group,
			ChatChannelType.Broadcast,
			ChatChannelType.Spectate,
			ChatChannelType.Battle,
			ChatChannelType.System
		};

		// Token: 0x04004107 RID: 16647
		private ChatChannelType[] showVoiceBar = new ChatChannelType[]
		{
			ChatChannelType.World,
			ChatChannelType.Curr,
			ChatChannelType.Team,
			ChatChannelType.Guild
		};

		// Token: 0x04004108 RID: 16648
		private ChatInfo mChatInfo;

		// Token: 0x04004109 RID: 16649
		private bool mIsVoice;

		// Token: 0x0200199F RID: 6559
		public enum ChatGroupState
		{
			// Token: 0x04007F4A RID: 32586
			GROUPS,
			// Token: 0x04007F4B RID: 32587
			CHATS
		}

		// Token: 0x020019A0 RID: 6560
		public enum ChatFriendState
		{
			// Token: 0x04007F4D RID: 32589
			FRIENDS,
			// Token: 0x04007F4E RID: 32590
			CHATS
		}
	}
}
